0
votes

I have a DataGridView that is populated using a list. During Runtime, the user can filter the data by entering data in a textbox. I am able to do the filtering part.

But the problem i am facing is when i change the datasource to the new datasource in the Textbox1_TextChanged event, the datagridview is populating the data with rows equal to the number of rows in my new datasource but each row is replica of the first row.

When I check the DataSource of the datagridview it has the data of the new DataSource.

So when I check the row selected in the datagridview_doubleclick event, the DataBoundItem gives me the exact object that it should give according the to new datasource.

What might have gone wrong??

1
Can you post some code ? - V4Vendetta
Are you filtering by way of changing the datasource? Please post some code. - Ken

1 Answers

0
votes

Maybe I am wrong, but do you need to clear the DataGridView when binding to a new datasource.... my binding skills are lacking....

Try clearing the DataGridView, before changing the datasource like :

DataGridView.Rows.Clear();