Programmatically selecting a row inside of a DataGridView

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm creating a C# (.NET BETA2) Windows application (NOT a Web application, a
Windows application), and I would like to programmatically selecting a row
inside of a DataGridView. It seems like it should be pretty easy to do, but
I'm have a hard time with this.

Can anyone give me any guidance?

Thanks,

David
 
It seems like you need to get the DataGridViewRow object, and set the
selected property to true in order to select the row. For example,

//assume there is a DataGridView object called dataGridView1
//and you wanna select the first row programmatically

dataGridView1.Rows[0].Selected = true;

Hope it helps
Ivan
 
Back
Top