Linq query to filter line items not starts with particular value

Hi Guys!!

I am using this linq query DT.AsEnumerable().Where(Function(w) w(“Amount”).ToString.Trim.StartsWith(“-”)).CopyToDataTable to filter line items starts with “-” sign.
How to filter rows that not starts with “-” using query? is there any similar query like this

Thanks in Advance

@rikulsilva @Palaniyappan

Hi @mohamedalthaf ,
You can negate the condition by just putting Not infront of it like shown below.

DT.AsEnumerable().Where(Function(w) not w(“Amount”).ToString.Trim.StartsWith(“-”)).CopyToDataTable


As suggessted
Add not before the w(“Amount”).Tostring


1 Like Thanks it is working

1 Like

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