469,281 Members | 2,484 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,281 developers. It's quick & easy.

Select Row in DataGridView

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
Oct 25 '06 #1
4 74180

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

Rich

GS wrote:
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
Oct 25 '06 #2
GS
Thanks for your answer, but it is nog working. The little black arrow is
still in the first row of the datagridview.

"koredump" <ko******@interia.plschreef in bericht
news:11**********************@m73g2000cwd.googlegr oups.com...
>
You also have to set the FirstDisplayedScrollingRowIndex.
Like this:
dataGridView1.FirstDisplayedScrollingRowIndex = 2

Rich

GS wrote:
>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

Oct 25 '06 #3
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...
Oct 25 '06 #4
GS
Ok, this do the job. Thank you!!

"Franz" <Fr***@discussions.microsoft.comschreef in bericht
news:18**********************************@microsof t.com...
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...

Oct 25 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Steve Richter | last post: by
6 posts views Thread by =?Utf-8?B?TWFyY2Vsbw==?= | last post: by
9 posts views Thread by Miro | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.