Question : How do I get a DataGridView to refresh after I modify the DataSource?

I have a DataGridView that has an instance of  List as it's DataSource.

I'm looking to perform some custom manipulation of the DataGridView's DataSource when the headers on the DataGridView are clicked. However, after some initial experimentation I found that I couldn't get the DataGridView to update the view of it's unerlying DataSource when I made changes to the strongly-typed list of BusinessObjects.

In the Mouse_Click event of the DataGridView Column Header I make changes to the list and then call Refresh() and Invalidate() on the DataGridView but this does not seem to work.

Does anyone know how to force the DataGridView to update when it's DataSource changes? Is the only way to do this to use an instance of BindingList> instead?

Answer : How do I get a DataGridView to refresh after I modify the DataSource?

If you are using Visual Studio 2005 then it is:
dataGridView.Refresh();

I can't remember what it is for 2003.
Random Solutions  
 
programming4us programming4us