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!!
 
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>)
 
Back
Top