Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / March 2008

Tip: Looking for answers? Try searching our database.

New/Delete

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JB - 11 Mar 2008 17:59 GMT
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.

Signature

JB

Jeroen Mostert - 11 Mar 2008 19:18 GMT
> 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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.