Reputation: 3437
I am currently working on my datagridview which is being populated by a stored procedure's query from the database. My question is how can I select the whole row even though I only click one cell?
Example, there are four columns returned by the stored procedure. So basically the datagridview will present to me data in four columns. If I select row 2 of column 3, is it possible that the action will not only highlight the row2 column 3 but the whole row 2?
Thanks very much!
Upvotes: 0
Views: 500
Reputation: 25505
There is a DataGridView.SelectionMode property you can set to fullrowselect.
Upvotes: 0
Reputation: 5480
You can set the SelectionMode of your datagridview to FullRowSelect
:
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
Upvotes: 1
Reputation: 561
DataGridView1.FirstDisplayedScrollingRowIndex = DataGridView1.Rows(counter).Index
DataGridView1.Refresh()
DataGridView1.CurrentCell = DataGridView1.Rows(counter).Cells(1)
DataGridView1.Rows(counter).Selected = True
Upvotes: 1