Solved

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

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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…

832 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