DataGridView doesnt refresh after setting datasource

  • Thread starter Thread starter green
  • Start date Start date
G

green

Ok - I have a DataGridView that has its datasource set as a collection
of business objects.

When I go to add a row, I add it to a database table which then
re-creates the collection based off of the database. The problem is
that when I go to set the datasource of the DataGridView to the newly
generated collection of business objects, the DataGridView doesn't
update right away...

What makes it more confusing is if I step through the application using
the debugger, it DOES work fine...

I thought maybe I had to do a "DoEvents()" type of dealio somewhere,
but alas, no...

Is there something obvious I'm missing? Something I have to do once I
set the datasource to a new collection? I've tried things like
DataGridViewObject.Update() and DataGridViewObject.Refresh() to no
avail...

Any help would be greatly appreciated...
 
Have you tried setting the datasource on the grid to Nothing,
and then re-setting it to the data source?

Robin S.
 
Back
Top