Question : Navigate to and Display specific DatGridViewRow

Experts

I have a DataGridView in VB.Net 2005 that is bound to a dataset.  The DataGridView has 1 column only, usually with lots of rows in alphabetical order.  My problem is that I need to allow the user to bookmark a specific row and then easily return to that row after scrolling through the grid.

I've tried the following:

Private BookMarkRow as DataGridViewRow

When the user selects a row to bookmark: BookMarkRow = DataGridView1.CurrentRow

So now the user would scroll through the grid for a while and then would like to view BookMarkRow with the click of a button.  I was hoping that BookMarkRow would expose a method like SetFocus or SetVisible or EnsureVisible etc etc but I cant find anything like it.

Any ideas?

Thanks

Answer : Navigate to and Display specific DatGridViewRow

First you have to memorize the selected row
 Dim iRow As Integer = dgv.CurrentRow.Index
        Dim iCol As Integer = dgv.CurrentCell.ColumnIndex

and then when you want to go to your bookmark

        dgv.CurrentCell = dgv(iCol, iRow)
Random Solutions  
 
programming4us programming4us