-
Hi.
I am encountering a weird error in my program. I have 2 forms and each form has a command button. When I click the command button from Form1, Form2 will be loaded. If I click the command button from Form2, I am unloading the form (by Unload Form2 function). However, after that, it performs again the "Load" event of Form2. In this case, loading of form 2 is being done twice. Even if I am just loading form2
from the command button of form1.
What's the possible cause of this occurrence?
Thank you very much.
Regards,
-
It's probably something in your code. Check and see if your code is similar to the following.
In Form1
Code:
Private Sub Command1_Click()
'Show Form2
Form2.Show
End Sub
In Form2
Code:
Private Sub Command1_Click()
'Unload Form2
Unload Form2
End Sub
-
Hi Megatron.
You know what, I have the same code as what you post here.
That's why this is so weird for me.
Thanks,
-
<?>
just a thought..perhpas it is hanging in memory.
Form1 cmdbutton
unload form1
set form1 = nothing
load form2
form2.show
-
Thanks HeSaidJoe! I got it! I just set form2 to nothing in unload event of form2.
Thanks a lot.
Regards,