Josh-CO Dev

Solving the worlds problems one line of code at a time.


Leave a comment

.NET – Filtering on a BindingSource

So here is another cool trick that I picked up recently. It is incredibly simple to filter on a binding source. Using this code, you can pull all the data back into a DataGrid, other other tool, and then let the users filter the data using the binding source. Thus, you can delimit the data without making subsequent calls to the database.

Here’s the code:

BingingSource.Filter = “FieldName= “Variable + “AND FieldName2= ” + Variable2;

Advertisements