473,473 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Clearing an Event

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
2 943
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
* "=?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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Michael Kennedy [UB] | last post by:
Hi, I have a situation where I need to clear the event sinks from an event inside a custom class. But I don't know which methods signed up for that event. Consider the following example: ...
0
by: Michał Januszczyk | last post by:
is there any way to tell whether the application has entered the shutdown state ? I put some data into aspnet cache. Special callback method is specified that should be called when cache item is...
1
by: scprosportsman | last post by:
Please help guys, i am trying to set up a database here at work and im fairly new to access in terms of writing functions and queries and stuff. I have 2 different places on my design that will...
5
jgroos
by: jgroos | last post by:
Here is the situation: I have 25 textboxes that are all handled by the same TextChanged event handler. My problem is, when I click my "Clear" button on the form, it clears all the textboxes and...
4
by: =?Utf-8?B?TmF2YW5lZXRoLksuTg==?= | last post by:
Hi all, Recently I found an interesting question on C# forums about clearing event handlers of an event. I tried to give it a solution, but failed. I am interested to know how you guys take...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.