CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2001
    Posts
    71

    Referencing an existing Form

    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.

  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868
    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.

  3. #3
    Join Date
    Sep 2002
    Location
    All around the World
    Posts
    99
    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.

  4. #4
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868
    Try this link, it describes exactly what you want:

    http://msdn.microsoft.com/library/en...lBasicNETUpgra<br%20/>dingToNET.asp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured