6
Answers

How to filter datagridview by making any change in the textbox

Photo of Samio

Samio

12y
5k
1
Using Linq to sql through bindingsource control in WinForms, I could not get this to work:

private void textBox1_TextChanged(object sender, EventArgs e)
{
this.productBindingSource.Filter = string.Format("dataGridViewTextBoxColumn1 like '%{0}%'", textBox1.Text.Trim().Replace("'", "''"));
productDataGridView.DataSource = productBindingSource;
}
When I type some letter in the textbox nothing happens in the datagridview.
Thanks for advices ...

Answers (6)