Sql – Best way of searching through a DataGridView in VB.NET

searchsqlsql servervb.net

On my form there is a datagridview that may get upwards to about 70k items depending on how scan happy our customers get. I also have a textbox which allows the user to search the datagridview using the textchanged event. I'm using a select statement with the like clause and filling the dataset. I dont think this will cut it, because the program hangs and gets laggy when there is a large amount of records. Whats the best way I can do this if performance is a top priority?

Best Answer

If you aren't worried about the number of records being selected, just download the entire dataset.

Create a dataview object on your filled table.

Set the DataGridView.DataSource = your dataview object.

Then, instead of using the textbox's textchanged event to fill the dataset, use it to change the .RowFilter property on your dataview.