DataGridView doesnt refresh after setting datasource

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...
 
R

RobinS

Have you tried setting the datasource on the grid to Nothing,
and then re-setting it to the data source?

Robin S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top