C#C
C#4y ago
Gibbo

DGV Filtering

evening all

ive got a DGV thats reading from a text file.

ive setup a filter using a combo box and a text box. this works fine with the 1st column but not with any other

this is my filter code

private void tsTB_Search_TextChanged(object sender, EventArgs e)
{
string SearchColumn = tsCB_Search.Text;
string SearchText = tsTB_Search.Text;

string rowFilter = string.Format("[{0}] = '{1}'", SearchColumn, SearchText);
(dataGridView1.DataSource as DataTable).DefaultView.RowFilter = rowFilter;
}
Was this page helpful?