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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top