Solved

Datagrid view: selected cell\column

Posted on 2009-07-09
2
524 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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.…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

11 Experts available now in Live!

Get 1:1 Help Now