Solved

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

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.NET 2008 - SQL Timeout 9 49
vb.net class 3 28
Get month and date in a format 4 44
How to get a Powershell script to launch from Visual Studio 20 63
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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 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