This is a vb.net, COM control interop question. I am creating a COM control
using the New operator
m_ctrl = New MyComCtrl
( use the automation interface for awhile, handle events, etc)
The question is how to delete the control now that I am finished with
it. Is there some operator in vb interop that corresponds to the delete
operator in c++? Managed code has more or less done away with the delete
operator but COM objects don't know anything about dispose, etc. In
particular, I want the destructor in the COM object to be called.
> This is a vb.net, COM control interop question. I am creating a COM control
> using the New operator
[quoted text clipped - 7 lines]
> operator but COM objects don't know anything about dispose, etc. In
> particular, I want the destructor in the COM object to be called.
This will happen automatically when the object is garbage collected. If for
some reason you really must release the object immediately (because the
object is holding costly system resources, for example), you can use
Marshal.ReleaseComObject(), but this normally isn't necessary.

Signature
J.
JB - 11 Mar 2008 19:43 GMT
Thanks for the reply. I will give that a try. The control in question uses
files that are closed in the destructor and so this must be called before
other code can access the files.

Signature
JB
> > This is a vb.net, COM control interop question. I am creating a COM control
> > using the New operator
[quoted text clipped - 12 lines]
> object is holding costly system resources, for example), you can use
> Marshal.ReleaseComObject(), but this normally isn't necessary.