Solved

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

Posted on 2013-05-16
3
172 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
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: …

757 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

19 Experts available now in Live!

Get 1:1 Help Now