Question #21465

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.

Expert's answer


//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);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS