Malfist
Malfist

Reputation: 31795

BindingSource.Filter doesn't work with '!='

I have a binding source and it has a column called Description and I want to exclude all rows that have their description set to 'x'.

I have tried:

bindingSource.Filter = "Description != ' + x;

That doesn't work. Does anyone know how to do a is not comparison for the binding source's filter? I couldn't find any help on MSDN.

Upvotes: 1

Views: 4139

Answers (2)

Anton Gogolev
Anton Gogolev

Reputation: 115741

Try <> instead of !=.

See this for more help:

http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx

Upvotes: 7

Alexander Kahoun
Alexander Kahoun

Reputation: 2488

Try this:

bindingSource.Filter = String.Format("Description != '{0}'", x);

One other thing to try is using <> instead of != if the above does still not work.

Upvotes: 0

Related Questions