Results 1 to 3 of 3

Thread: Multiple forms causing problems

  1. #1
    samcp16 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jan 2012
    Posts
    8
    Reputation
    0

    Question Multiple forms causing problems

    Hello, im trying to create a main menu for my game im creating using multiple forms and a button on each form to switch, i manage to get the forms to switch back and forth but when switching to the form that the game is displayed on, the key presses im using to control the avatar stop working (and continue to not function even when the main menu form is removed, resulting in me having to load a back up copy), here is the code im using in each button click.


    Dim SecondForm As New Form1
    SecondForm.Show()
    Me.Hide

    Dim SecondForm As New Form2
    SecondForm.Show()
    Me.Hide




  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    14,177
    Reputation
    2368
    If you don't intend to have multiple instances of the forms active at the same time I'd say use the default form instances. Form1.Show() etc.

  3. #3
    samcp16 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jan 2012
    Posts
    8
    Reputation
    0
    I also tried what you suggested before but the same thing happened, it just wont let me use any key presses, other than that it works so im quite puzzled to be honest, could it be that the first form isn't closed but only hidden and its interfering with the form the game is running on? (I have also tried form1.close but there is still the same error)


    Thanks for your help

Bookmarks

Posting Permissions

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