Link to home
Start Free TrialLog in
Avatar of Tom Sage
Tom SageFlag for United States of America

asked on

How to select a value in the selected row?

Hello,
How can I select the row pointed to by the arrow in the left column?  I have tried this code:

DataGridView.CurrentRow.Cells(0).Value

but it does not select the row that the arrow in the left column is pointing to.  

Thanks
Avatar of tiagosalgado
tiagosalgado
Flag of Portugal image

Try DataGridView1.SelectedRows(0).Cells(0).Value
Avatar of Jorge Paulino
If you want to select the row (with the arrow on the left column) you can do this:
 

        Dim col As Integer = 2
        Me.DataGridView1.CurrentCell = Me.DataGridView1(0, col)

Open in new window

<please ignore this comment>
Olá Tiago,
Ainda bem que vejo mais um Português por aqui.
Um abraço
</please ignore this comment>
<please ignore this comment too>
Olá Jorge,
É verdade, já tinha visto que tb andas por cá.
Um abraço
</please ignore this comment too>
Avatar of Tom Sage

ASKER

I think I did not explain exactly what I need.  

I need the value of cell zero on the row on which the arrow is currently pointing.  I do not need to select the row.

Thank you
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you for your quick answer.