Click here to Skip to main content
15,921,793 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello friends
i have a DataGridView in my form with many rows.
i want to search a string in DataGridView with a textBox.so when user type a name in textBox,immediately it will be shown on datagridview by entering string on textBox.
I mean Dynamic Search.
please help.
Posted

1 solution

Use BindingSource.Filter:

C#
public void textBox1_TextChanged(object sender, EventArgs e)
{
    this.BindingSource.Filter = string.Format("Column_Name Like '%{0}%'", this.textBox1.Text);
}
 
Share this answer
 
v3
Comments
Member 12674831 9-Aug-16 5:05am    
is this working ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900