This works fine:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim con As New SqlConnection("server=localhost;uid=sa;pwd=xx;database=northwind")
Dim daCust As New SqlDataAdapter("Select * from Customers", con)
Dim daOrders As New SqlDataAdapter("Select * from Orders", con)
Dim ds As New DataSet()
daCust.Fill(ds, "Cust")
daOrders.Fill(ds, "Orders")
ds.Relations.Add("CustOrd", ds.Tables!Cust.Columns!CustomerID, ds.Tables!Orders.Columns!CustomerID)
'
'Bind the controls.
'
TextBox1.DataBindings.Add("Text", ds.Tables!Cust, "CustomerID")
TextBox2.DataBindings.Add("Text", ds.Tables!Cust, "CompanyName")
TextBox3.DataBindings.Add("Text", ds.Tables!Cust, "ContactName")
DataGridView1.DataSource = ds.Tables!Cust
DataGridView1.DataMember = "CustOrd"
'
'Initialize the CurrencyManager.
'
cm = CType(Me.BindingContext(ds.Tables!Cust), CurrencyManager)
End Sub
However I want textbox1 to be a combobox filled with the customer names, bound to the customer ID in the orders table and updating as the records are paged through, but can't figure out how to do it - can't get the binding right.
Thanks.