Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Datagridview for Master/Detail in VB.net 2005
 

Datagridview for Master/Detail in VB.net 2005

I have two datagridview tables and I want to build a master/detail relationship of these two tables. I can make a query to show data on master table but don't know how to link detail table to master table. Especially I don't know how to build a datarelation between master and detail. Detail table has 5 columns to form a primary key. The following is my code:

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = System.Windows.Forms.Keys.F11 Then

Try

Me.BGHuntedTableAdapter.Fill(Me.SurveysDataSet.BGHunted) \this is my master table

Me.BGHarvestTableAdapter.Fill(Me.SurveysDataSet.BGHarvest) \this is my detail table

Catch ex As System.Exception

System.Windows.Forms.MessageBox.Show(ex.Message)

End Try

End If

End Sub

Somebody please give me some good direction. Thanks.

Ben

BenGoodman  Wednesday, August 05, 2009 5:39 PM
Ben,

Also take a look at this site. There is a good explanation on how to use relations in datasets.

http://msdn.microsoft.com/en-us/library/system.data.dataset.relations.aspx

Kind regards

Michel
MichelSg  Thursday, August 06, 2009 9:53 AM

Hi Ben

Which application are you using to build your program?

Kind regards,

Michel

MichelSg  Thursday, August 06, 2009 9:51 AM
Ben,

Also take a look at this site. There is a good explanation on how to use relations in datasets.

http://msdn.microsoft.com/en-us/library/system.data.dataset.relations.aspx

Kind regards

Michel
MichelSg  Thursday, August 06, 2009 9:53 AM

You can use google to search for other answers

Custom Search

More Threads

• SqlConnection and sp_reset_connection problem
• DataGridView Help
• DataGirdView: Vertical Scrollbar Problem
• checkbox without the box
• Performance problems when affecting BindingList to DataGridView
• .EndEdit() within .FormClosing eventhandler not processed ?
• Current Control doesn't refresh values due to PropertyChanged event
• DataGridView and Thread concurrency
• How to get a column data count in a datagridview?
• How to get SUM from created datatable