Solved

Datagrid view: selected cell\column

Posted on 2009-07-09
2
553 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…

730 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