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 / Windows Forms / Design Time / December 2004

Tip: Looking for answers? Try searching our database.

How can I tell the TypeConverter to Dispose or destruct C#.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gert - 10 Nov 2004 04:47 GMT
Hi

I have a PropertyGrid that loads one of my objects. The Object has a
TypeConverter that I build to display a list of values. If the grid
closes I would like to do some cleanup.

In the constructor of the TypeConverter I registered an event so that
the TypeConverter is notified when the list data has changed.

In the destructor I would like to deregister the event.

How do I get it to call my Dispose method?

Thanks
Gert
Jay - 10 Nov 2004 05:27 GMT
Are u creating a instance of TypeConvertor...

Jay

> Hi
>
[quoted text clipped - 11 lines]
> Thanks
> Gert
Ulrich Sprick - 13 Dec 2004 18:16 GMT
Hi Gert,

you show a component in the property grid. Your component should override
the  Dispose( bool disposing ) method. This method is called when the
container (component, form, designer) is shutdown. Here is the logic:

hth,
ulrich

- - - -

public class MyDerivedComponent : MyBaseComponent
{
  ...
  protected override void Dispose( bool disposing )
  {
       if ( disposing )
       {
           // call Dispose() on all contained objects
           // that implement IDisposable
       }

       base.Dispose(disposing);

       // free unmanaged ressources
   }
}

> Hi
>
[quoted text clipped - 11 lines]
> Thanks
> Gert

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.