Filter Data Table. How to Get only JPG and PNG from Data Table and also i want to exclude some string in JPG. How to do that

Column Name is New Column 0

@Puneet_Singh please show me datatable or excel. And eloborate what you want to do

In this i want to exclude Docs, excel and Signed Name JPG and some more text JPG.

HI,

Can you try the following?

excludeWords = {"waste","fuel","battery"}
validExts = {".jpg",".png"}

Then

dtResult = dt.AsEnumerable.Where(Function(r) validExts.Contains(System.IO.Path.GetExtension(r(0).ToString).ToLower) AndAlso (not excludeWords.Any(Function(s) r(0).ToString.ToLower.Contains(s)))).CopyToDataTable()

Regards,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.