MDI adding controls

chitt0040

New member
Joined
Jul 12, 2005
Messages
3
Programming Experience
Beginner
RESOLVED - MDI adding controls

I have an MDI with parent form-Form1 and child form-Form 2 . I want to add a control to the parent form (form1) on a Button_Click event from a Button on the child form. ??
I've tried to find MSDN articles and other forum posts, but nothing that really helped. Any info or links to related topics would be great.
 
Last edited:
I want to press a Button on the MDI ChildForm to add a TChart (Steema TeeChart, which is a control) to the MDI ParentForm. I believe I'm just having trouble referencing the controls between the Parent and Child forms.

An example adding a Button control to the ParentForm (instead of the TChart) would give me a good idea.

Thank you for the help
 
There are tutorials in the VS help on creating controls in code (Code: Adding a Windows Forms Control at Runtime (Visual Basic)). You just have to decide whether you want the parent form to add the control itself or the child form to add it to the parent. If the former, then put the code in a method in the parent and call that method from the child. If the latter, then put the code in a method in the child and add the control to the parent from there. You have a reference to the parent form in the child form via the MdiParent property.
 
Back
Top