Need help with reset variables
I am building a program based on forms. I created few forms and declare public variables to calculate price which is displayed when one of that form is load based on values from previous forms.
I will do loop back to first form but when I do that all variables are not resetting.
I done this way:
frm_name.visible = true
me.visible = false
Please give me some advice please.
If somebody is interested I email that program.
Re: Need help with reset variables
Welcome to VBForums :wave:
Thread moved from the 'Contests' forum to the 'VB.Net' (VB2002 and later) forum
For the benefit of others, Lukasz-Z's profile says VB 2010
Re: Need help with reset variables
Hiding and showing a form doesn't reset any variable values. If you want to reset some certain variables while keeping some others, you have to do it manually. On the other hand, if you want to reset all variables, just close the form and recreate a new instance of the form again.
Code:
'close the form
form_name.Close()
'Then show the form again
form_name.Show()
'Or this
Dim myform As New form_name()
myform.Show()