Select and Highlight an entire row in DataGridView
Select and Highlight an entire row in DataGridView
C#
int rowToBeSelected = 3; // third row
if ( DataGridView1.Rows.Count >= rowToBeSelected)
{
// Since index is zero based, you have to subtract 1
DataGridView1.Rows[rowToBeSelected - 1].Selected = true;
}
VB.NET
Dim rowToBeSelected As Integer = 3 ' third row
If DataGridView1.Rows.Count >= rowToBeSelected Then
' Since index is zero based, you have to subtract 1
DataGridView1.Rows(rowToBeSelected - 1).Selected = True
End If
Good Work !!!
Thanks,
Kiran
______________________
india-jobs-opening.blogspot.com