Question Details View Control

Sollyk

Member
Joined
Sep 11, 2011
Messages
6
Programming Experience
Beginner
Thanks for the previous reply,it help.

Pls, how do I bind two related tables to one BindingNavigator control in Details view control

NB: If i drag the tables in DataGrid View it works but if I drag them in Details View it fails.
 
You don't. Each BindingNavigator is associated with one BindingSource and each BindingSource is bound to one DataTable. Perhaps you could explain exactly what you started with, exactly what you did and exactly what you ended up with when using a DataGridView and the same for details view.
 
I have two tables Customer and Products. i need to create a form that will store each customer's details and their Products details using TabControl (Page Customer and Page Product) with one Navigator so that I can ( addNew,Delete,Save,moveNext,MovePrevious,movefirst and MoveLast).
 
You can't do that with a DataGridView even. What you're talking about is two different things. First, you need a BindingNavigator for the parent data. You then need parent/child data binding so that, when you select a parent, that parent's children are displayed. That's nothing to do with the BindingNavigator. Parent/child data binding will do that no matter how you select a parent.

For parent/child data binding, you need two DataTables in a DataSet and a DataRelation between them. For the parent BindingSource, you select the DataSet as the DataSource and the parent DataTable as the DataMember. For the child BindingSource, you select the parent BindingSource as the DataSource and the DataRelation as the DataMember.

Whether or not this can be done automatically by dragging from the Data Sources window, it can certainly be done manually by adding all the desired components from the Toolbox and then setting the appropriate properties. If you've already dragged from the Data Sources window and things aren't quite right, open up the Properties window and adjust the data bindings appropriately.
 
Back
Top