Destroying Objects

muthuraman

Newcomer
Joined
Aug 13, 2003
Messages
12
I recently upgraded my application from Visual Basic 6 to Visual Basic .NET.

I have a ADODB Command Object. In Visual Basic 6, I was able to destroy this object saying, Set obj = Nothing

But .NET uses garbage collection and I am not able to use Nothing. I can't wait till the object is garbage collected as I have to initilize it and use it for someother purpose.

I came across the 'dispose()' method. But this works only for VB components and not for ActiveX objects.

Can anybody help me with this please?.

Thanks,
Muthuraman
 
I think that as soon as the sub finishes that the object is declared finished, the object will go out of scope, and .NET's COM interop will handle the freeing of the COM object. I don't think there is any function to need to worry about to free the memory.
 
Back
Top