Tutorial :Maintain currently selected row in a datagridview



Question:

When loading the data from the database and then displaying to the datagridview, the record pointer will point to the first row of the datagridview.

Is it possible to maintain the record pointer to the current selected row in a datagridview after refreshing the records?


Solution:1

I would preserve the DataGridView.CurrentCellAddress (I forget the type) before refreshing the DataGridView. After refreshing, check that the Cell at that address is still valid. Then, set the DataGridView.CurrentCell to the Cell at that address.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »