I made a program in C#, I am retrieving data from a text file in datagridview.
I made a textbox, i want to do whenever user types into a textbox, the datagridview filter and shortlist the matching data automatically.how can i do that? I am new to c#, Please send me the code.
thanks in advance.
1
Expert's answer
2013-01-29T07:51:58-0500
//This is example of code filtered by column "Name" private void buttonFilterClick(sender object, EventArgs e) { DataSet ds = new DataSet(); ds.ReadXML(fileName); DataView dv = new DataView (ds.Tables[0]); //ds.Tables["name"] grid.DataSource = dv; dv.RowFilter = string.Format(" Name& like '{0}' ", textBox1.Text); }
Comments
Leave a comment