Determine visible row # in winforms datagrid?

X

xlar54

How can I tell which rows are visible in a datagrid (winforms app)? I
have alot of data in the grid (bound to a datatable), and I need to
refresh that data frequently. (theres no easy way to know what data
has changed), so Im looking at just updating the visible portion of the
grid if this is possible.
 
X

xlar54

Ah found my own answer:

int firstVisibleRow =
dataGrid1.HitTest(dataGrid1.PreferredRowHeight+10,dataGrid1.RowHeaderWidth+10).Row;


int lastVisibleRow = firstVisibleRow + dataGrid1.VisibleRowCount;
 

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