Author | Message | Time |
---|---|---|
l2k-Shadow | Let's say I'm trying to access an ActiveX .dll using this code [code] Dim obj as Object Set obj = CreateObject("Project1.Class1") obj.HelloWorld [/code] now how can I properly free this object? [code] Set obj = Nothing [/code] is not doing it. [code] Unload obj [/code] cannot be done | September 23, 2006, 1:47 AM |
RealityRipple | IIRC, VB6 automatically unloads objects when the form they're on (or the sub/function they're in) are unloaded (or completed). | September 23, 2006, 2:03 AM |
l2k-Shadow | Well I have the object loaded in a public variable to do things with it throughout the program until I need to unload it, and I just want to unload that object, not the entire program. | September 23, 2006, 2:15 AM |
RealityRipple | Ah... I'm not sure you can do that... Try creating a form that acts as the holder of the object, and then Loading/Unloading the form when you want to load/unload the object. Remember to Set Form1 = Nothing when you unload. | September 23, 2006, 2:51 AM |
l2k-Shadow | [quote author=RealityRipple link=topic=15771.msg158753#msg158753 date=1158979870] Ah... I'm not sure you can do that... Try creating a form that acts as the holder of the object, and then Loading/Unloading the form when you want to load/unload the object. Remember to Set Form1 = Nothing when you unload. [/quote] i'd rather not unload it than do something so lame. | September 23, 2006, 3:25 AM |
ImaWh0re | I have a great quote of some newb saying someone was an idiot because of a memory leak in their application, and that they didn't know how to unload objects when finishing the use of them. When infact there was no memory leak involved in the program. Oh wait...that newb was.... ---THIS ARROW POINTS UP---^ | September 23, 2006, 4:32 AM |
Stealth | Set obj = Nothing has worked for me in the past.. where have you seen a problem with it? | September 23, 2006, 7:12 AM |
l2k-Shadow | I solved this thanks. | September 23, 2006, 3:54 PM |