parent/child form 
Author Message
 parent/child form

I have 3 separate, but similar forms. User is to choose which form he wants to
work on. The forms has these common fields: lastname, firstname, position. The
forms also have common menu items: save,print, etc. I am new to VB, and don't
know how Object Oriented Programming works with Visual  Basic. Would this be
possible: Create 1 (template) form which contains the common elements: lastname,
firstname, position & common menu items: save, print, etc. (create a class with
these common elements?). Use this template (/class) as the 'parent' of the 3
forms. Whenever a change is made in the parent/template form, will be reflected
in the 3 child forms. Would this be possible to do, and how do I go about doing
it? Is there a reference material I should be looking at (I don't know what to
look for). Thank you all!!!!


Mon, 08 Sep 2003 07:21:01 GMT  
 parent/child form
You can instanciate new forms of your current form.
Heres what you do:

Create a new Module:
    On the menubarClick Project/Add Module

Type add the following code in the module:
Dim Forms(3) As New Form1                'array of new forms, where Form1 is
of course your form

Private Sub Main()
    Forms(1).Caption = "Form1"
    Forms(2).Caption = "Form2"
    Forms(3).Caption = "Form3"
    ' any other specific changes here
    Forms(1).Visible = True
    Forms(2).Visible = True
    Forms(3).Visible = True
End Sub

By default, when you instanciate a new form it's visible property is set to
false.

Now right-click on your project in the toolbox and click properties:
    Change the Startup Object to "Sub Main"

And your on your way

Hope it helps
Cheers
Cobus Jacobs


I have 3 separate, but similar forms. User is to choose which form he wants
to
work on. The forms has these common fields: lastname, firstname, position.
The
forms also have common menu items: save,print, etc. I am new to VB, and
don't
know how Object Oriented Programming works with Visual  Basic. Would this be
possible: Create 1 (template) form which contains the common elements:
lastname,
firstname, position & common menu items: save, print, etc. (create a class
with
these common elements?). Use this template (/class) as the 'parent' of the 3
forms. Whenever a change is made in the parent/template form, will be
reflected
in the 3 child forms. Would this be possible to do, and how do I go about
doing
it? Is there a reference material I should be looking at (I don't know what
to
look for). Thank you all!!!!



Mon, 08 Sep 2003 22:16:55 GMT  
 parent/child form
Cobus Jacobs,
Thanks for your help. I need to have the 3 individual forms at design time, since
I need to add a lot of other controls to the individual forms. Would that be
possible?
Quote:
-----Original Message-----

You can instanciate new forms of your current form.
Heres what you do:

Create a new Module:
    On the menubarClick Project/Add Module

Type add the following code in the module:
Dim Forms(3) As New Form1                'array of new forms, where Form1 is
of course your form

Private Sub Main()
    Forms(1).Caption = "Form1"
    Forms(2).Caption = "Form2"
    Forms(3).Caption = "Form3"
    ' any other specific changes here
    Forms(1).Visible = True
    Forms(2).Visible = True
    Forms(3).Visible = True
End Sub

By default, when you instanciate a new form it's visible property is set to
false.

Now right-click on your project in the toolbox and click properties:
    Change the Startup Object to "Sub Main"

And your on your way

Hope it helps
Cheers
Cobus Jacobs



I have 3 separate, but similar forms. User is to choose which form he wants
to
work on. The forms has these common fields: lastname, firstname, position.
The
forms also have common menu items: save,print, etc. I am new to VB, and
don't
know how Object Oriented Programming works with Visual  Basic. Would this be
possible: Create 1 (template) form which contains the common elements:
lastname,
firstname, position & common menu items: save, print, etc. (create a class
with
these common elements?). Use this template (/class) as the 'parent' of the 3
forms. Whenever a change is made in the parent/template form, will be
reflected
in the 3 child forms. Would this be possible to do, and how do I go about
doing
it? Is there a reference material I should be looking at (I don't know what
to
look for). Thank you all!!!!

.



Tue, 09 Sep 2003 00:20:09 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. MSHFlexGrid format child side in parent child form

2. Parent/Child forms and calling functions......

3. Parent/Child form

4. ADO and parent child forms

5. Using scroll bars with parent/child forms

6. Sizing MDI parent child forms

7. Adding data to parent child forms

8. 2nd Time Editable Parent Child form in VB

9. MDI Parent / Child form questions.

10. requery parent form when user adds a record to child form

11. how child form find out parent form?

12. Modifying object in MDI Parent form from MDI Child form

 

 
Powered by phpBB® Forum Software