I have a dataGridView
and I need that when the user clicks on any cell the whole row that contains this cell is selected too. (it has multiselect disbaled)
I tried getting the currentRowIndex
like this
int Index = dataGridView1.CurrentCell.RowIndex;
However, I am not sure how to use the index in order to select that row.
Tried this and about other six ways with no success:
dataGridView1.Select(Index);
Do you know a way I can do this?
Best Answer
You need to set datagridview's
SelectionMode
toFullRowMode
.Note: In Visual Studio 2013 with .NET 4.5 the property is called
FullRowSelect
.