Select and Highlight an entire row in DataGridView



Select and Highlight an entire row in DataGridView

C#
int rowToBeSelected = 3; // third row
if (dgv.Rows.Count >= rowToBeSelected)
{             
       // Since index is zero based, you have to subtract 1
        dgv.Rows[rowToBeSelected - 1].Selected = true;
}

No comments:

Post a Comment