Solved

Datagrid view: selected cell\column

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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQl Query to find x consecutive Nbrs in a Table 30 94
VB.Net - Not Sure if Multi-threading is What I Need 4 29
SQL Syntax 24 42
RAISERROR WITH NOWAIT 2 14
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

766 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