Solved

How to select a value in the selected row?

Posted on 2008-10-12
7
170 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now