ok i first load a form and have it say lbltest.width = 15, with a timer to increase that every 100 milliseconds
then i unload it and later load it again, yet when i reload it the lbltest.width is not 15(much much longer in fact)
why does it do this?
Printable View
ok i first load a form and have it say lbltest.width = 15, with a timer to increase that every 100 milliseconds
then i unload it and later load it again, yet when i reload it the lbltest.width is not 15(much much longer in fact)
why does it do this?
well when you unload a form make sure you stop any timers that are on that form, else when you show the form again the code you left executing will still be going
unload me
Mike
Remember that an unload of a form doesn't destroy the form, hence the code is still in memory. You have to set the form to Nothing after the Unload otherwise the variables, properties etc. , when you do a new load of the form, will still have the values they had at the time of the unload.
So
Set frmYourForm = Nothing
solves your problem.
Yeap Iceman,
I've experienced the same thing like yours. And, I only do 2 things, they are :
- Set the width in code, not in design !!!
- Do just exactly like what Laurens told you... Set the form to NOTHING !!!
I believe, those two steps will help you a lot.
BRgds,
Wen Lie
you could just load the lbltest.width into a global variable on unload and reload the lbltest with that value
in the form activate.
what do you mean by set a form to "NOTHING"? (im relativly new, but learning fast)
is that some function or do you mean to say to reset all the values i need to 1 by 1
and 2nd do timers keep running even if i unload the form?
When you set it to Nothing, the variables are all destoryed. They do not refer to any object.