Solved

Datagrid view: selected cell\column

Posted on 2009-07-09
2
542 Views
Last Modified: 2012-05-07
Hi guys,

I need to find out the value of the selected cell and also the column name to which the cell belongs.

I'd appreciate any code examples or links for the API with examples. I looked on MSDN, couldn't find anything to solve my problem.

Thank you
0
Comment
Question by:Inglorious
  • 2
2 Comments
 
LVL 18

Assisted Solution

by:UnifiedIS
UnifiedIS earned 75 total points
ID: 24815811
The cellclick event of the datagridview exposes the rowindex  and columnindex (e.rowindex, e.columnindex).
get the row:
dim dgr as datagridviewrow = datagridview1.rows(e.rowindex)
get the column within the row:
dgr.cells(e.columnindex).value


or datagridview1.rows(e.rowindex).cells(e.columnindex).value
0
 
LVL 18

Accepted Solution

by:
UnifiedIS earned 75 total points
ID: 24815839
datagridview1.columns(e.columnindex).name will tell you the column name
0

Featured Post

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Store results in vb.net 3 20
Winform Module - What is the ASP.Net equiv 2 21
Expression Evaluater 3 25
SQL Use Distinct with two fields 3 11
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
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.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

773 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