I'm writing a program with many forms and many global variables.
I defined my variable in a module and in one form (form2
) I assigned a value to them. Then, by clicking the "Calculate" button, I jump to in another form (form3
) and I use my variable to extract results.
I have a problem with my back key. My code for backing is:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Close()
Form2.Show()
End Sub
When I go back to form2
, my text boxes have the past values (as I need them to) but when I change the value and click on the calculate button again, there is no change in my result because my variable doesn't change. Please help me what should I do?
If possible, declare and show it inside the calculate button click event handler and pass the parameters to it inside the calculate button click event handler.
This way, each time the form is close and the calculate button click event handler completes, form3 is disposed and next time you click the calculate button, the form is recreated and receives new values. – David Wilson Dec 07 '16 at 10:25