Detect selected GRID row
Paul Witmond
Hi,I've created a small form with a small grid on it
The user has to select one line and press OK
Now I need to know what grid line the user selected.
This must be very easy but I can't find it.
Who has an example ?
Thanks,
Paul
Anders Olsson
Hi Paul,You can use the SelectedRows property of the Grid object to find out which rows are selected.
Example:
for (int i = 0; i < grid.SelectedRows.Count; i++)
{
int rowIndex = grid.SelectedRows.RowIndex(i);
MessageBox.Show(rowIndex.ToString(), "OK");
}
Kind regards,
Anders Olsson
0
Please sign in to leave a comment.
Comments
0 comments