Click to See Complete Forum and Search --> : How can you show 2 forms at once?


Mark1
July 10th, 2001, 04:02 PM
Hi,

I have buttons and graphics on two seperate forms. However when I hit `Run` only Form 2 shows up. How can I reveal both forms and have the 2nd form placed underneath the first. Also, How can I link buttons on the 1st form, to things that happen on the 2nd?

Thanks

Mark

John G Duffy
July 10th, 2001, 04:23 PM
In the form_Load or Form_Activate event of the form that shows up issue a Formx.SHOW to show the second form.
A more sophisticated way would be to add a SUB MAIN in a module, Set the startup Object in project properties to Sub MAIN.
In sub main issue two statements like this


public Sub Main()
Form1.Show
Form2.Show
End Sub




John G

Kdev
July 10th, 2001, 04:28 PM
Under project properties there is a setting called StartUp object. You set this to the object you want to start when you run the app. If you want Form1 to start first then set this to Form1.

If you want to also show Form2 on startup then in the Load event of Form1 put this line:

Form2.Show

As far as linking objects from one form to the other use just reference them in code using the Form Name as the qualifier. Example:

In Form1:

private sub Command1_Click()
Form2.Text1.Text = "Message from Form1"
End Sub


-K