i am creating a basic game, something a bit like space invaders but only 3 levels long.
I'm haveing trouble moving from Form2 (level 2) to Form3 (level 3), Form3 opens, Form2 closes, and I want the start menu (which is on another form called Start) to show if one of the forms closes, but i don't want it poping up infront of the game when ever i move onto the next level, which is what it does.
I want to show the start form because if the user closes a form they should be led back to the start menu.
i have used this code on Form1 (level 1) to move onto Form2 but i don't know how to get it to work for moving from Form2 to Form3:
section of code from Start form:
Public Sub goto2() frmLevel1.Close() Dim frmLevel2 As Form2 frmLevel2 = New Form2 frmLevel2.Activate() frmLevel2.Show() Me.Hide() End Sub
Section of code from Form1:
If MessageBox.Show("Play Next Level?", "Yes/No question", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.No Then MsgBox("Okay, Bye") Start.Show() 'Me.Enabled = False Close() Else MsgBox("Okay! Good Luck") Start.goto2() End If
i want to use this again in Form2 to move to form 3 but i don't know how.