Datagrid and the Primary Key

ahbenshaut

Well-known member
Joined
Oct 29, 2004
Messages
62
Location
Alaska
Programming Experience
5-10
I'm new to VB.net so please help me out gently. I have populated a datagrid using a dataset. What I would like to do is once a user clicks on a row, I need to be able to get the primary key of the record , then display the rest of the information about the selected row in labels that are located under the datagrid. I have been able to get the currentrowindex but after that I am kinda lost.

Please help!!
 

srinivas

New member
Joined
Nov 3, 2004
Messages
2
Programming Experience
3-5
On the required event of the datagrid just put this:

datagrid.Item(dg.CurrentCell.RowNumber, <column index of the primay key column in the datagrid>)
 
Top Bottom