MDI & passing Data around

Equis

Member
Joined
Sep 1, 2006
Messages
9
Programming Experience
Beginner
Hello

vb2005

If I had an frmInvoice and called frmFindCustomer to find customer details, how would I pass the results of frmFindCustomer back to frmInvoice?

Because there could be many frmInvoice open at any one time how would I get the correct one?

Is there an index property or something I could use?

Thanks :)
 
Hello

Thanks for the link

I may have read it wrong but I dont think it had anything about passing data back to a mdi instance.

Thanks anyway, the link was usefull

:)
 
A form is a form, whether its an MDI parent, MDI child, modal dialogue, modeless dialogue or standard top-level form. Also, all forms are just objects like any other. All this means is that you pass data to and from all forms in exactly the same way as you pass data to and from all objects. To affect another object you must have a reference to it. You pass data into an object by calling a method and passing a parameter or by setting a property. You get data out of an object by either calling a method and getting the return value or getting the value of a property. That's all there is to it.

Now, if what you're asking is how can one child form pass data to another child form then think about how the equivalent action would be taken in real life. Each child has a reference to the parent in its MdiParent property. The parent has a reference to each child in the variables that YOU declred specifically for the purpose, or else more generally through its MdiChildren collection. That measn that the parent is the link between the two children. Now, let's say that I wanted to give you something. I don't have any way to contact you directly but we do have a mutual friend. That means that I can give the item to our mutual friend and they can give it to you, or else the mutual friend can give me your contact details so I can get in touch with you directly. Do you see how the two are analogous? We are the MDI children and the mutual friend is the MDI parent.
 
Back
Top