Solved

How to select a value in the selected row?

Posted on 2008-10-12
7
190 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:MisterT25
  • 3
  • 2
  • 2
7 Comments
 
LVL 8

Expert Comment

by:tiagosalgado
ID: 22698847
Try DataGridView1.SelectedRows(0).Cells(0).Value
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 22698933
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

0
 
LVL 48

Expert Comment

by:jpaulino
ID: 22698941
<please ignore this comment>
Olá Tiago,
Ainda bem que vejo mais um Português por aqui.
Um abraço
</please ignore this comment>
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 8

Expert Comment

by:tiagosalgado
ID: 22699005
<please ignore this comment too>
Olá Jorge,
É verdade, já tinha visto que tb andas por cá.
Um abraço
</please ignore this comment too>
0
 

Author Comment

by:MisterT25
ID: 22699510
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
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 22699524
That way you can use:


Debug.WriteLine(DataGridView1.CurrentRow.Cells(0).Value)
0
 

Author Closing Comment

by:MisterT25
ID: 31505499
Thank you for your quick answer.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question