Reputation:
I have big problem. I have 2 forms in my VB.NET project. The names of Forms are Form1 and Form2. I have a button with this codes:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Hide()
Dim Login As New Form2
Login.Show()
End Sub
Now when I click in this button Form2 will open, but after 3 or 4 minutes Form1 will open again. I should say Me.close() to same happen with Me.Hide() for me.
Public Class Form2
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim fff As New Form2
fff.Close()
Form3.Show()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
MsgBox("Sorry", MsgBoxStyle.MsgBoxHelp, "Error")
End Sub
I need help please
Upvotes: 0
Views: 230
Reputation: 9
try this
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Login As New Form2
Form2.Show()
Me.dispose()
End Sub
it should solve the problem
Upvotes: 0