473,406 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Question on events

Hi All,
when you chain an event eg tb.Enter+= ; Is it possible to ensure I will get the first bite at the event
and also is it possible to refuse access to this event lower down the chain.

hope my question makes sense.
thank you.
Jan 10 '06 #1
4 1049
It didn't make sense to me, but I'm not so smart anymore since I stuck
my fork in the power outlet...

What chain are you talking about?
What "bite" are you talking about?

Are you asking that in the event handling method if you will get the
first character in the textbox?
And are you also asking if it is possible to prevent other objects
which can see your textbox object, from also handling the same event?

I feel like a monkey without a banana in this thread.

Jan 11 '06 #2
No, you'll need to create a specially built class to do that.

Jan 11 '06 #3
Hello,

I don't think you can stop the execution of the other methods once the event
has been fired.

Note that doing "tb.Enter = new ..." with delele all the previous methods
that where
registered with the event.

--
Francois Beaussier

<Co**********@al.com> a écrit dans le message de news:
11***************@eunomia.uk.clara.net...
Hi All,
when you chain an event eg tb.Enter+= ; Is it possible to ensure
I will get the first bite at the event
and also is it possible to refuse access to this event lower down the
chain.

hope my question makes sense.
thank you.

Jan 11 '06 #4
> Is it possible to ensure I will get the first bite at the event

No. Even if you could know for sure the order that the handlers will be
called by the event delegate, you should never depend upon that.

If you are subclassing, then you should override the OnEnter() method
rather than subscribing to the Enter event, for exactly this reason.
However, if your event subscriber is not a subclass of the class that
defines the Enter event, then there are no guarantees about the order
in which you'll be called.
it possible to refuse access to this event lower down the chain


Technically, no, but a similar mechanism does exist in .NET. Take a
look at KeyPressEventArgs: event arguments that contain a boolean
(Handled) that indicates "I've already handled this... don't bother
with it." In this case, however, it's not events "lower down the chain"
that are being advised that the event has been "handled," but rather
the default behaviour in the defining class that kicks in _after_ the
event is raised and only if Handled comes back from all event handlers
as false.

Jan 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dixp | last post by:
I'm new to writing multithreaded apps and I have a design question. I have a winforms app and a class which has a method that does processing which is time intensive. I want the user to be able...
10
by: Paulo Jan | last post by:
Hi all: Let's say I'm designing a database (Postgres 7.3) with a list of all email accounts in a certain server: CREATE TABLE emails ( clienteid INT4, direccion VARCHAR(512) PRIMARY KEY,...
0
by: OutOfAlignMent | last post by:
Hi, I had a few question about Events. 1. From some test code I've written it appears that the events notifications are sent to the subscribers in the order in which they where...
5
by: ECVerify.com | last post by:
This should be a basic question. In VB.NET in the two drop downs over the source code for a form you can get a list of the events and overrides for that form. In VC++ in the properties window...
4
by: Andrew S. Giles | last post by:
Does anyone know if it is possible for an Event to be raised/fired in C++ and then caught/handled in C# and vice versa in a .NET environment? If so, does the C# and C++ code need to be in the same...
44
by: craig | last post by:
I am wondering if there are some best practices for determining a strategy for using try/catch blocks within an application. My current thoughts are: 1. The code the initiates any high-level...
5
by: Charles Law | last post by:
I think I asked the wrong question last time, so I am starting a separate post to distinguish them. Take five classes: ClassA and ClassW...Z ClassA raises five events: Event1...5 ClassW...Z...
10
by: jack | last post by:
Hi guys, I am working on a project which requires an implementation of discrete event simulation in C using linked lists. I would greatly appreciate if someone could provide with some sources...
4
by: DeveloperX | last post by:
I'm having a play with EventHandlerList but the documentation is a bit ropey and I can't find any decent examples. It also doesn't seem to do what I was led to believe it would. I was under the...
16
by: RSH | last post by:
I was reading a tutorial on OOP principals and design and I stumbled on something that I don't understand. The tutorial used a Oven class. In that class there was a private field called...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.