DataGridView doesn't refresh when DataTable rows are changed

D

Dagan

Hello

I have 2 threads, one for adding\removing rows to\from DataTable that is
bind to DataGridView and the main thread that views the DataGridView, when I
change any row in the DataTable the DataGridView display doesn't refreshed,
if I make the change in the DataTable from the main thread, any change in
the DataTable is displayed immediately in the Grid, What is the cause of it
and how can it be resolved?

Thanks.
 
R

Rimmer

Hi Dagan,
I had this problem last year.
To my knowledge, the fact that the update to the datatable is being
performed on a seperate thread stops the events firing on the gridview
to cause the refresh. In effect the datatable cannot communicate with
the datagridview because of they are on seperate threads.

A temporary solution I used was to periodically refresh the gridview
rather than relying on the events to come from the datatable.

my advice? Try to avoid this situation. I ended up coding my applicatio
to not show / refresh the datagridview when the work was being
performed in the other thread as it caused exceptions and other issues
that generally made the application unstable.

hope this helps
PS: why did you post this in so many forums? only post it in ONE forum.


Anthoney
www.nowpromote.com.au
 

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