If the event you need isn't already provided by the control (something like
Leave) I don't see how you could avoid writing code in each of these other
controls to call the notify event, or function, or whatever you use to
implement it. So you're saying that you have to subclass all these controls
because the events already given don't do what you need? I would agree with
the last two posters. Either make each of your controls call a public method
on the notifying control, with some sort of identification of the sender, or
make a new event delegate and add that event to each of the notifying
controls, let the class receiving the notification subscribe to each of
those events, and then add logic in each of the controls with the events to
fire the event when appropriate.
Chris
"Tom Bean" <tb***@t-a-c.com> wrote in message
news:#1**************@TK2MSFTNGP10.phx.gbl...
Andrew,
That would mean that all kinds of objects, like textboxes, comboboxes,
listboxes...would have to have the same notify event. That's a lot of
duplicate code in the other objects to just be able to notify a single
object that something has happened,
Tom
"andrew lowe" <andrew [dot] lowe [at] geac [.] com> wrote in message
news:er****************@tk2msftngp13.phx.gbl...
"Tom Bean" <tb***@t-a-c.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Can events be used to notify an object that something has happened and it needs to take some action?
Most of the documentation on events makes them sound like they work
the other way around, that is, an object raises an event to inform other objects that something happened. I need the ability for many objects to
notify a single object that some event has occurred. e.g. similar to LostFocus.
Tom,
Whats wrong with having the single object subscribe to the each of the
other objects "notify" event(s) ?
andrew