I am new to programming and to VB.net. I have a 5-form program. On the last form, I have a button that will restart the program at Form1 again if the user wants to do it again. However, when it goes to the beginning, it still has the values stored as the Public Variables from the previous use. How can I clear those values of the Public Variables so the user can start fresh?
Here is my code for the button click on Form5:
vb
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If MsgBox("Are you sure you want to start again?", MsgBoxStyle.YesNo Or MsgBoxStyle.DefaultButton2 Or MsgBoxStyle.Critical) = MsgBoxResult.Yes Then
Dim f As New Form1()
f.Show()
Me.Hide()
Else
Exit Sub
End If
End Sub
/vb
Thanks for any help.
Here is my code for the button click on Form5:
vb
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If MsgBox("Are you sure you want to start again?", MsgBoxStyle.YesNo Or MsgBoxStyle.DefaultButton2 Or MsgBoxStyle.Critical) = MsgBoxResult.Yes Then
Dim f As New Form1()
f.Show()
Me.Hide()
Else
Exit Sub
End If
End Sub
/vb
Thanks for any help.