hiding the form didn't do it. Having the last thing the button does be unloading the form is what did it. Think of it this way..
All the code in your form is essentially part of the form. If you unload it, you can't execute the code in it. So having a function that does the following..
Is a problem waiting to happen. You're telling the form to unload but you have code in that form that's still waiting to execute. I can't say speciffically what will happen if this is done but I'd guess that eitherCode:Unload Me MainForm.Visable = True
a) The part after the Unload isn't going to happen.. or
b) the form is going to try to unload and cancel because
there's still code to execute.
You don't have to specifically hide the form but if you want to make the form not visable while something else happens then you may want to..
In the above example, the correct way to do it would be
but that will make the main form visable and then make the sub form go away. That may not be the visual effect that you want.. so you'd do..Code:MainForm.Visable = True Unload Me
Code:Me.Hide MainForm.Visable = True Unload Me
Let me know if this answered your question...




Reply With Quote