Capturing data from a datagrid

Aaronsmity

New member
Joined
Nov 18, 2006
Messages
2
Programming Experience
Beginner
can anyone tell me if there are any methods of the datagridview control object that will capture which row the user has selected and retrieve a value from a field in that row? ex- user clicks on second row and i want to retrieve the "email" field from that row and put it in a textbox. I have been fiddling around with the .getselectedrows method but have been unsuccessful and i am unfamiliar with datagridview methods, any ideas? thanks
 
DataGridView1.SelectedRows is a collection of all the selected rows

DataGridView1.SelectedRows(3).Cells(27) will retrieve the 28th value from the 4th selected row. Remember that indexes are 0 based, and do check that there IS a 4th selected row before you try and access it
 
Back
Top