Solved

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

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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