You shouldn't set the DataSource property and call the SetDataBinding method. The SetDataBinding method is how you set the DataSource and DataMember of the DataGrid at runtime. You are setting it in code so it is not necessary to use this method.
>Hi Cathi,
>
>I fixed the datarelation problem. But it’s spoiling my databinding, when I add this line to my datagrid:
>Me.dgMeasurements.SetDataBinding(myDS, "Member.MemMsr")
>
>This is the code, I think I am missing somethign some where??
>
>
>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")
>
>Thanks for the help
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi