Click to See Complete Forum and Search --> : Referencing an existing Form


vivek_29
October 10th, 2002, 07:11 AM
Hi.
This might be a very basic queston but pls. excuse my ignorance for this.
I am developing a VB.NET Windows based application.
My Application has got 3 Forms Namely :

Form1
Form2
Form3

My Startup Form is Form1

In the Form_Load Event of Form1, I make an instance of Form2 and open it.
In the Form_Load event of Form2, I make an instance of Form3 and open it.
In my Form3 I have a button.

Now on the Button_Click event in Form3 I want to activate Form1.

How can I acheive this because I don't have the reference of exixting Form1.

Pls. help me to get this thing sorted out.

Regards.

DSJ
October 10th, 2002, 08:18 AM
You need to pass a reference when (after) you create each form, like:

dim Frm2 as form2 = new form2()
frm2.Parent = me


Of course you'll have to define a Property called Parent in form2, and form3 etc. But then you'll have the reference you need.

e_har
October 10th, 2002, 10:24 PM
Errmmm, DSJ do you know where i can learn more on this or can you elaborate here. I'm trying to do this with my second project but i don't know how to start.

DSJ
October 14th, 2002, 08:33 AM
Try this link, it describes exactly what you want:

http://msdn.microsoft.com/library/en-us/dv_vstechart/html/%20vbtchWorkingWithMultipleFormsInVisualBasicNETUpgra<br%20/>dingToNET.asp