How to get the value which is selected in gridview?
When I click on a row I should get the value o开发者_JS百科n which the user is clicked
How do I get that?
How about one of these event:
DataGridView.CellClick
DataGridView.CellContentClick
DataGridView.RowEnter
If I have understood you correctly, then you'll want the SelectedIndexChanged event.
If the grid's SelectionMode is set to FullRowSelect or FullHeaderSelect, you can get the selected row(s), using
DataGridView.SelectedRows
Then for each row you can use the Cells property to get the values.
There are a wide variety of ways to get at the underlying data set.
精彩评论