Results 1 to 3 of 3

Thread: MDI - variable scope

  1. #1

    Thread Starter
    Fanatic Member Geespot's Avatar
    Join Date
    Oct 2001
    Location
    Birmingham, UK
    Posts
    577

    MDI - variable scope

    Hi

    Im new to VB.NET and to be honest, not used MDI much in VB either.

    My Application will consist of several forms, and I thought it be best to put them all into a MDI form.

    There will only be one instance of each form, and I would like to know how I can show another form from within another.

    In my MDI container form, I declared at the top, the form variables I would like to use

    VB Code:
    1. '-- Declaration section of MDI Container
    2.     Public formWelcome As New WelcomeForm()
    3.     Public formAddCD As New AddCDForm()

    so I can access those variables anywhere in my MDI container.

    How can I show and manipulate formAddCD from formWelcome?

    the following doesn't work, vb.net can't find the variable formAddCD
    VB Code:
    1. '-- Inside WelcomeForm
    2.         Private Sub WelcomeForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    3.         MdiMain.formAddCD.Show()
    4.     End Sub

    Thanks

  2. #2

    Thread Starter
    Fanatic Member Geespot's Avatar
    Join Date
    Oct 2001
    Location
    Birmingham, UK
    Posts
    577
    I done it, i moved the two form declarations to a Module.

    but still, is there a way I can do it without a module?

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Geespot
    I done it, i moved the two form declarations to a Module.
    but still, is there a way I can do it without a module?
    you can use either ways , in a module or in a class .Storing your variable in a module is a good idea .It will be public to other forms in your proj.

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