|
-
Sep 24th, 2012, 01:47 AM
#1
Thread Starter
Fanatic Member
datagridview selected row
i use this code to select a curent row
dgvProduct.Rows(iCount).Selected = True
but the cursor (|>) something like was still on the first row of the grid.. what should I do?
-
Sep 24th, 2012, 02:35 AM
#2
Re: datagridview selected row
In DataGridView terms, "selected" just means highlighted. Given that multiple rows can be selected at the same time, it couldn't mean anything else.
The row that contains focus is actually the current row, which is accessed via the CurrentRow property. That property is ReadOnly though, so you can't set it. It is simply defined as the row containing the CurrentCell, which you can set.
If you index the grid itself by column and row, you are invoking the Item property and that will return the cell at those coordinates. You can then assign that cell to the CurrentCell property and that will also implicitly set the CurrentRow and CurrentCellAddress properties.
-
Sep 24th, 2012, 01:19 PM
#3
Member
Re: datagridview selected row
You can also use the FirstDisplayedScrollingRowIndex property of the datagridview to show the row you want without selecting it. e.g.
dgvProducts.FirstDisplayedScrollingRowIndex = icount
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|