Need help with forms.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lildemon0108
    New Member
    • May 2007
    • 1

    Need help with forms.

    I am currently trying to program a game with multiple forms. As of now I have it hide the main form that loads when the program is executed. I am having difficulties getting this form to be unhidden when the user clicks the button to return to the main form. Here is snippets of the code i have so far:
    Main Form
    Me.Hide()
    Dim Set1 As New Set1
    Set1.ShowDialog ()
    That part works fine. The main form is hidden and they can use Set1 correctly.
    Here is where the problem comes in...
    Set1
    Me.Close()
    Form1.ShowDialo g()

    The main form is called Form1 in design and it tells me, "Reference to a non-shared member requires an object referance."

    Any help would be appreciated.
  • SanjuMtr
    New Member
    • Mar 2007
    • 47

    #2
    Originally posted by lildemon0108
    I am currently trying to program a game with multiple forms. As of now I have it hide the main form that loads when the program is executed. I am having difficulties getting this form to be unhidden when the user clicks the button to return to the main form. Here is snippets of the code i have so far:
    Main Form
    Me.Hide()
    Dim Set1 As New Set1
    Set1.ShowDialog ()
    That part works fine. The main form is hidden and they can use Set1 correctly.
    Here is where the problem comes in...
    Set1
    Me.Close()
    Form1.ShowDialo g()

    The main form is called Form1 in design and it tells me, "Reference to a non-shared member requires an object referance."

    Any help would be appreciated.
    in VB.NET everything treated as object.
    So, when you call form1.showdialo g() ,you do not create object for Form1. i.e why the error occur.
    I just change the code. Please Check it.
    Code:
           dim tmpMain as new Form1
            tmpMain.ShowDialog()
            Me.Close()
    if u r problem has been solved .then Plz make an End of Tag. Thank U.

    Comment

    • Dököll
      Recognized Expert Top Contributor
      • Nov 2006
      • 2379

      #3
      It looks like:

      Code:
      ....part of your code here
      
      Unload Me
      Form1.Show
      
      End
      Should work here. Have you tried that?

      Dököll
      Last edited by Dököll; May 9 '07, 01:17 AM. Reason: Code tag

      Comment

      Working...