Hi,
Charles A. Lackman said:
Hello,
I hope this helps.
Customers Table (This works): (CustomerDataset)
ID - Integer
Name - VarChar
Address - VarChar
Contacts Table (This works): (CustomerDataset)
ID - Integer
ContactName- VarChar
ContactPhone- VarChar
The Relationship (This works):
CustomerDataset.Relations.Add("Children",
CustomerDataset.Tables("Customers").Columns("ID"),
CustomerDataset.Tables("Contacts").Columns("ID"), False)
The DataViewManager (This works):
TheCustomerView = New DataViewManager(CustomerDataset)
Ok so far...
Find a Row in the Child Table??? (This does NOT work):
I guess you mean child view ? Because if you want to find a row inside the
child table, then you could simply use the child table.
Dim RowPosition as Integer
CustomerView.DataViewSettings("Customers.Children").Table.DefaultView.Sort
=
"ID"
RowPosition =
CustomerView.DataViewSettings("Customers.Children").Table.DefaultView.Find("12")
Move to the Row (This works):
BindingContext(CustomerView.DataViewSettings("Customers").Table,
"Children").Position = RowPosition
You're using the Table property, so that's the exact same as:
BindingContext( CustomersDataSet.Tables("Customers"), "Children" ).Position
= RowPosition
Anyways, you still haven't shown how you setup the bindings, so i can only
guess, but it looks like you have bound the child Control(s) to the
Customers table and Childeren relation, you're not even binding to the
DataViewManager and you probely don't need to. Maybe this is what you are
looking for:
Dim childCM As CurrencyManager
Dim childDV As DataView
' when getting the CurrencyManager from the BindingContext, you
' need to use the same DataSource(ref) and DataMember (excluding
' fieldname; can be empty) as you used to setup the DataBinding
childCM = DirectCast( BindingContext(CustomersDataSet.Tables("Customers"),
"Children"), CurrencyManager )
childDV = DirectCast( childCM.List, DataView )
childDV.Sort = "ID"
childCM.Position = childDV.Find("12")
HTH,
Greetings