Creating form based on OrderHeader table containing subform "OrderDetail"

adi2015

Member
Joined
Mar 4, 2015
Messages
17
Programming Experience
3-5
Hi,

I am trying to create OrderHeader form which will contain subform "OrderDetail". User can input data about order header (date, customer etc), and in subform user will be able to input as much rows he likes (I plan to use datagrid view). You can see relationship between these tables bellow.

15_Mar_15_9_50_13_PM.jpg
I am confused how to "connect" these two data sources on one form? I plan to create form based on OrderHeader table and then to drag&drop datagridview object which will contain source from table OrderDetail table. Even if I manage to connect them, do I have to modify main code for saving data that currently looks like this

VB.NET:
Me.Validate()
Me.OrderHeaderBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.BazaDataSet)

Any help is appreciated and many thanks in advance!
Adi
 
On the first form you have a DataSet that contains the parent table and the child table. When you open the second form, you pass the child table to it. Simple. The table gets bound to the DataGridView in the Load event handler.
 
Hi, it does sounds simple but I can't get it work. I am trying for 5 days now;( Can you please recommend me some link/example?

Thank you.
Adi
 
Hi, it does sounds simple but I can't get it work. I am trying for 5 days now;( Can you please recommend me some link/example?

Thank you.
Adi
What are you having trouble with? If you don't know how to pass data from one form to another then follow the Blog link in my signature below and check out my three-part series on Data Among Multiple Forms.
 
Back
Top