Select Row in DataGridView

G

GS

Hello,

In a DataGridView, I programmaticly select a row with:

dataGridView1.Rows[2].Selected = true;

That row is selected and blue, but...
In the RowHeader, the little black arrow is still on the first row until I
click on the row with the mouse.

The question, how can I set the little black arrow on the selected row,
without a mouseclick.

Thank you for you help.
GS
 
K

koredump

You also have to set the FirstDisplayedScrollingRowIndex.
Like this:
dataGridView1.FirstDisplayedScrollingRowIndex = 2

Rich
 
G

GS

Thanks for your answer, but it is nog working. The little black arrow is
still in the first row of the datagridview.

koredump said:
You also have to set the FirstDisplayedScrollingRowIndex.
Like this:
dataGridView1.FirstDisplayedScrollingRowIndex = 2

Rich
Hello,

In a DataGridView, I programmaticly select a row with:

dataGridView1.Rows[2].Selected = true;

That row is selected and blue, but...
In the RowHeader, the little black arrow is still on the first row until
I
click on the row with the mouse.

The question, how can I set the little black arrow on the selected row,
without a mouseclick.

Thank you for you help.
GS
 
G

Guest

the second row is selected but is not the CurrentRow.

try this:

DataGridView1.CurrentCell = DataGridView1[0, 2]

this code set the second row as the currentRow...
 

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

Top