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 / Languages / Managed C++ / October 2005

Tip: Looking for answers? Try searching our database.

Removing EventHandle[s] from a Timer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Oliphant - 06 Oct 2005 00:12 GMT
Once I add an event handler to a Timer, how do I remove it? For my purposes
it is good enough to remove ALL event handlers as I'll only have one
associated with the Timer at any time.

Basically, I'm looking for something like:

timer->Tick = NULL ;

Maybe that will work (haven't tried it)? I'm guessing if it does the
EventHandler[s] associated with it, being garbage collected, should go out
of scope and be destroyed. But that's only if the above method makes
sense...

Thanks in advance for any responses! : )
Alex Thaman - 07 Oct 2005 16:36 GMT
I think you want

timer->Tick -= new YourEventDelegate(instance, yourEventHandler);

Check out http://msdn2.microsoft.com/en-us/library/4b612y2s for an example of how this is done.  This is a reference for the new C++/CLI syntax.  If you are using __event, check out http://msdn2.microsoft.com/en-us/library/cb1dzt8t.

-Alex

-----Original Message-----
From: Peter Oliphant
Posted At: Wednesday, October 05, 2005 4:13 PM
Posted To: microsoft.public.dotnet.languages.vc
Conversation: Removing EventHandle[s] from a Timer
Subject: Removing EventHandle[s] from a Timer

Once I add an event handler to a Timer, how do I remove it? For my purposes
it is good enough to remove ALL event handlers as I'll only have one
associated with the Timer at any time.

Basically, I'm looking for something like:

timer->Tick = NULL ;

Maybe that will work (haven't tried it)? I'm guessing if it does the
EventHandler[s] associated with it, being garbage collected, should go out
of scope and be destroyed. But that's only if the above method makes
sense...

Thanks in advance for any responses! : )

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.