adsc
Feb 22nd, 2003, 11:01 AM
I have created a one to one relation between parent “member” table and a child “Measurements” table, the relation works fine.
The problem is, the child table displayed in a DataGrid in the upper area of the form, & the bottom area I have some textbox which the data in the DataGrid binded to it, meaning when the user clicks on any row in the DataGrid, details should appear in this textboxs, but this is not happening !!!
I wonder if I have a coding error, next is the code used:
myDA.Fill(myDS, "Member")
myMeasureDA.Fill(myDS, "Measure")
‘ Add DataRelation the DataSet
myDS.Relations.Add("MemMsr", myDS.Tables("Member").Columns("MemberID"), myDS.Tables("Measure").Columns("MemberID"))
' cbSelect Member DataSource
Me.cbSelect.DataSource = myDS.Tables("Member")
Me.cbSelect.DisplayMember = "MemberID"
‘ Bind data in the first window form
Me.txtMemberName_e.DataBindings.Add("Text", myDS.Tables("Member"), "Name_e")
Me.dgMeasurements.DataSource = myDS.Tables("Measure")
‘ the next line is spoiling my next databinding
Me.dgMeasurements.SetDataBinding(myDS, "Member.MemMsr")
‘ bind the 2nd window form (*** this binding get spoiled ***)
Me.txtWeight.DataBindings.Add("Text", myDS.Tables("Measure"), "Weight")
Me.txtHeight.DataBindings.Add("Text", myDS.Tables("Measure"), "Height")
Any idea where is the problem?
Thanks for the help
The problem is, the child table displayed in a DataGrid in the upper area of the form, & the bottom area I have some textbox which the data in the DataGrid binded to it, meaning when the user clicks on any row in the DataGrid, details should appear in this textboxs, but this is not happening !!!
I wonder if I have a coding error, next is the code used:
myDA.Fill(myDS, "Member")
myMeasureDA.Fill(myDS, "Measure")
‘ Add DataRelation the DataSet
myDS.Relations.Add("MemMsr", myDS.Tables("Member").Columns("MemberID"), myDS.Tables("Measure").Columns("MemberID"))
' cbSelect Member DataSource
Me.cbSelect.DataSource = myDS.Tables("Member")
Me.cbSelect.DisplayMember = "MemberID"
‘ Bind data in the first window form
Me.txtMemberName_e.DataBindings.Add("Text", myDS.Tables("Member"), "Name_e")
Me.dgMeasurements.DataSource = myDS.Tables("Measure")
‘ the next line is spoiling my next databinding
Me.dgMeasurements.SetDataBinding(myDS, "Member.MemMsr")
‘ bind the 2nd window form (*** this binding get spoiled ***)
Me.txtWeight.DataBindings.Add("Text", myDS.Tables("Measure"), "Weight")
Me.txtHeight.DataBindings.Add("Text", myDS.Tables("Measure"), "Height")
Any idea where is the problem?
Thanks for the help