How to programatically select first row of DataGridView [duplicate]
Possible Duplicate:
Selecting a row in Datagridview Programatically?
I am developing a ne开发者_StackOverfloww desktop application in C# using Windows Forms. In one of my form i put the DataGridView Control
and i am populating this dataGridViewControl
Dynamically using my custom functions.
Now after populating the above control, is there any way to programatically select the first row of that DataGridViewview
. Note: the Selection mode property of this DataGridView is set to "Full row Select"
Try:
dataGridView1.Rows[0].Selected = true;
To select one row in winform DataGridView TRY THIS:
dataGridView1.MultiSelect = false;
dataGridView1.MultiSelect = true;
dataGridView1.Rows[RowIndex].Selected = true;
It works ..
精彩评论