|
-
Jul 17th, 2000, 05:37 PM
#1
Thread Starter
Member
How do you unload forms from within your code. And I dont mean HIDING them.
thanks,
Wick
-
Jul 17th, 2000, 05:46 PM
#2
Use the Unload method
Code:
'Will unload Form2
Unload Form2
'Will unload the current Form you are in
Unload Me
-
Jul 17th, 2000, 09:06 PM
#3
You are best to free up any resources in use from your program as well. You can do this by unloading all forms:
Code:
Public Sub UnloadAllForms()
Dim OfTheseForms As Form
For Each OfTheseForms In Forms
Unload OfTheseForms
Set OfTheseForms = Nothing
Next OfTheseForms
End Sub
Or just one:
Code:
Unload Form1
Set Form1 = Nothing
-
Jul 17th, 2000, 09:17 PM
#4
Hyperactive Member
Forms are funny things in VB...
They are in reality "Classes" and the second you show your form it has actually created an instance.
The problem then is you cannot get rid of the actual forms themselves unless you actually created a NEW instance of them and use it.
As Matthew said above, if you "Dim" an instance of your form, use it, unload it and then set it to nothing you have successfully gotten rid of every last trace of the form from memory.
If however you just started using the form by calling its name directly you will have that form hanging around and although you can unload it I am not sure if you can set it to nothing....
People often get confused with VB5 and VB6 thinking that forms are some "special" kind of entity when they are really classes... As many people don't understand object-orientation and classes they fail to understand how forms REALLY work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|