Filtering value from datatable with loop taking time

I am using for each row to check value of specific column from datatable and inside loop I am using if condition for checking whether value exists in the datatable or not.

Process is taking time can we do it without loop?

Hi,

You can check it with linq query.

Try this:
yourDT.AsEnumerable().Any(Function(x) x(“yourDatatableColumn”).ToString = DesiredValue)

Thanks @ghazanfar

Hi @lorun_hiper

DataTable.AsEnumerable.Where(Function(dr) Convert.ToString(dr(“YourSearch Column”)) = "YouSearchString")
it will return True Or false based on value exits

If You need to copy the value as datatable or list

DataTable.AsEnumerable.Where(Function(dr) Convert.ToString(dr(“YourSearch Column”)) = "YouSearchString").CopyToDatatable/List

Regards