Dailycode.info

Short solution for short problems

Set Datagridview selection

How to select a row in a datagrid view using c# .Net

Very simple, but to fnid this out, it can still take up some of your precious time.

So I will place the code here to easy the pain. (I got my info here.)

Set the datagridview to fullrowselect. Then use this code to select the row you want. First we scroll the datagrid to the record, then we select the record.

dataGridView1.FirstDisplayedScrollingRowIndex = Row;
dataGridView1.Refresh();
dataGridView1.CurrentCell = dataGridView1.Rows[Row].Cells[0];
dataGridView1.Rows[Row].Selected = true;