Pass values from one form to another

diverdan

Active member
Joined
Jan 2, 2006
Messages
34
Location
London UK
Programming Experience
Beginner
Hi there,

I am using vb express 2005.

I have built a form that contains customer details and have also built a form for orders (frmCustomers & frmOrders)

I have added a button on the customer form to ADD an new order. The frmOrder is then opened.

My question is how do I take the customerid from frmCustomer and transfer information into the frmOrder e.g. postal address?

I have a textbox on both forms called txtCustomerID.

Can anyone suggest what I need to do?

Thanks for your help!
 
you can create a class and pass the value to that particular class when you close the form. So if you need the data you can go to that class and get the value.
 
I think that I was having a similar issue and I was helped out in the following manner:

place this code on the form that is receiving information

PublicSub SetReceive(ByVal Value AsString)
some control or variable = Value
EndSub

place this code on the form that is sending the information

PrivateSub Openform()
Dim whatever AsNew frmFormName
whatever.SetReceive(some control.text or variable)
whatever.Show()
EndSub

You can add more than one Reciever on your form to handle more than one value.

Public sub SetReceive2....ect

Hope that is some help
 
Back
Top