Hi Everyone !

I'm having a problem with a Datagridview control, I hope somebody can
help me since I tried many things but I cannot nail the solution.
I have a Datagridview displaying the contents of a database that
change continuously, but the changes are minimum (around 2 or 3 rows
change over 180, every 10 seconds), and I'm reading this database
through a separated thread and then refreshing the datagridview each
10 seconds. All the threading thing is already debugged and working
fine. The problem is not connected with it.
The user should be able to scroll the datagridview normally during the
refresh process, but it happens that when the program comes to this
line where I update the datagridview itself (after reading the
database):

dataGridView1.DataSource = dt;     (dt is a datatable which I populate
with database values)

If I were scrolling with the mouse, the mouse looses control and I
have to take again the scroll bar, this is very anoying for the user
since refresh is very often.

I don't know if I'm doing things right, so I have a few questions:

1) If I don't assign the datasource in each database reading, the
control doesn't refresh its content. Is this normal? The datagridview
content shouldn't automatically follow the content of dt (datatable)?

2) In case this assign I describe before is necessary, is there a way
to avoiding this loose of control I'm experimenting?

Thanks in advance
Nacho

Reply via email to