Exposing a field value in a selected datagridview row

mrRogers

Well-known member
Joined
Jan 23, 2016
Messages
45
Programming Experience
3-5
I want to capture a two field values in a selected row which will be used in another query for another table. I can reveal the cell value of a cell clicked in "currentcell.value" but not the one beside it.
 
Just as there's a CurrentCell property, there's a CurrentRow property. That property exposes a DataGridViewRow so you can access its Cells collection. That said, if you're handling a cell-related event then you probably have access to the index of the row via the 'e' parameter. You can use that to get a row from the grid's Rows collection or use the grid's Item property and provide the appropriate column index along with that row index.
 
Back
Top