U
User_of_VB
Guest
Hi All, can you please see this code and tell me what is wrong with it?
I've got two forms (frmMain and frmHelp) i need 2 buttons on frmMain (btnExit, btnHelp) and one button on frmHelp.
Here is my code:
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Dim X As New frmMain()
Me.Close()
Dim Y As New frmHelp()
Y.Close()
End Sub
Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHelp.Click
Dim X As New frmHelp()
X.Show()
Dim A As New frmMain()
A.Visible = False
End Sub
End Class
It runs properly, but the times i press Help button from main form - that many times i need to press button exit on the main form to exit the program...
And Here is the code for frmHelp
Private Sub btnMainMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMainMenu.Click
Dim X As New frmMain()
X.Show()
Dim Y As New frmHelp()
Me.Dispose()
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
End Class
Fnyone can help ???
Any suggestions would be appreciated!
I've got two forms (frmMain and frmHelp) i need 2 buttons on frmMain (btnExit, btnHelp) and one button on frmHelp.
Here is my code:
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Dim X As New frmMain()
Me.Close()
Dim Y As New frmHelp()
Y.Close()
End Sub
Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHelp.Click
Dim X As New frmHelp()
X.Show()
Dim A As New frmMain()
A.Visible = False
End Sub
End Class
It runs properly, but the times i press Help button from main form - that many times i need to press button exit on the main form to exit the program...
And Here is the code for frmHelp
Private Sub btnMainMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMainMenu.Click
Dim X As New frmMain()
X.Show()
Dim Y As New frmHelp()
Me.Dispose()
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
End Class
Fnyone can help ???
Any suggestions would be appreciated!