I have got 2 problems...
1)
How can I find the visible no. of rows in a datagridview and the index of the top row during vertical scroll.I am using visual studio 2005 windows application in c#.

2)
How to refresh datagridview's particular no. of rows instead of refreshing the entire datagridview when there is any change in database table which I am binding to dataset.
Most importantly how do I find that what all rows have been updated with changed values
while binding to dataset so that I can refresh only those affected rows to the datagridview
from next time onwards

please suggest me or provide solution

Recommended Answers

All 4 Replies

You can take the hight and divide it by the row height to work out the number that would be visible, to work out which are on screen, hmm, you could probably use the scroll event to work out what the current position is.

Thank u for ur reply
Canu please provide any suggestion for the other issue

If you just wish to update the visible rows, then well I explained how id expect to work out whats visible, so you could just do a query that retrieves those rows

Actually what I am doing is ..
one thread is calling the database to dataadapter ..Another thread is binding to dataset...repeatedly after 5 seconds..
Now I have more than 50000 rows in my dataset table ..So for better performance
I want to update only those rows from dataset to datagridview whose values are not the same from second instance..
datagridview's datasource is dataset

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.