Selecting a DataGridView Row that is not in View

P

Patrick

I have a data-grid view already populated.

This is what should happen when I click a button
1) Detect selected rows
2) Calls SP to bulk update a flag on selected row
3) Refresh data-grid
4) Data-grid "scroll back" to the row user was on before

I tried the following which works only if the row selected is on the first
page (i.e., visible without having to page down on the DataGridView.
myDataGridView.Rows[indexRow].Selected =true;
myDataGridView.Rows[indexRow].Visible = true;

What code should I use to handle rows selected which are not in view without
page downing.
 
J

Jack Jackson

I have a data-grid view already populated.

This is what should happen when I click a button
1) Detect selected rows
2) Calls SP to bulk update a flag on selected row
3) Refresh data-grid
4) Data-grid "scroll back" to the row user was on before

I tried the following which works only if the row selected is on the first
page (i.e., visible without having to page down on the DataGridView.
myDataGridView.Rows[indexRow].Selected =true;
myDataGridView.Rows[indexRow].Visible = true;

What code should I use to handle rows selected which are not in view without
page downing.

I'm not sure what you are attempting to do with that code fragment.
Why do you care if selected rows are in view?

If you are trying to do #4, you can use the FirstDisplayedCell
property.
 

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