Solved

How to get the record details if on click of any data in gridview.

Posted on 2013-05-16
3
178 Views
Last Modified: 2013-06-07
I have record which is populated in a datagridview in vb.net.
It contains 3 fields id,name,emailid,city
How to make every record clickable.
So that if I click on any row, I should be able to read the id of that particular row and a new form should get opened where I can fetch the data for that particular id.
0
Comment
Question by:searchsanjaysharma
[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
3 Comments
 
LVL 40
ID: 39173902
You can retrieve the row on which a user clicked by using the following in the MouseClick event of the grid:

yourGrid.HitTest(e.Location.X,e.Location.Y).RowIndex
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39174405
Handle CellMouseDoubleClick event and it will give you both rowindex and columnindex which you can then use to get ID and pass to details form

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellmousedoubleclick.aspx
0
 

Author Closing Comment

by:searchsanjaysharma
ID: 39229027
tx
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

626 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