By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,261 Members | 1,674 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,261 IT Pros & Developers. It's quick & easy.

Clearing an Event

P: n/a
A quick question...

In my program I handle an event, but the way it is programed the event gets "handled" twice. Is there a way to clear the event after it is handled the first time

Thank
Brad
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Brad,

You can either set a switch (the most simple method) or otherwise remove the
handler temporary (the most difficult method).

Did you know the static keyword which is very usable for a switch, with that
you do not have to set it public but can keep it in your procedure something
as.

static myswitch as boolean

if myswitch then
'do what you want
myswitch = false

I hope this helps?

Cor
Nov 20 '05 #2

P: n/a
* "=?Utf-8?B?QnJhZA==?=" <an*******@discussions.microsoft.com> scripsit:
In my program I handle an event, but the way it is programed the event
gets "handled" twice. Is there a way to clear the event after it is
handled the first time.


If your event is called 'Foo', then you can use 'FooEvent' to get "more
options". There you can get the 'InvocationList', add handlers
('Combine') and remove handlers using 'Remove'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.