Consuming event of a class in collection

  • Thread starter Thread starter rawCoder
  • Start date Start date
R

rawCoder

< Sorry msg got removed on last attempt from vb newsgroup >

Hi,

I must be missing something here.

All I want is to be able to handle the events of one of my class, objects of
which are in a collection.

For e.g. I have a class MyClass1 which raises MyEvent1 and a collection
which holds its objects. I want to be able to handle the events when any
object of MyClass1 raises a MyEvent1.

rawCoder
 
rawCoder said:
< Sorry msg got removed on last attempt from vb newsgroup >

Hi,

I must be missing something here.

All I want is to be able to handle the events of one of my class,
objects of which are in a collection.

For e.g. I have a class MyClass1 which raises MyEvent1 and a
collection which holds its objects. I want to be able to handle the
events when any object of MyClass1 raises a MyEvent1.

Use the Addhandler statement to attach event handlers to events of an
object. An alternative - if possible - is to declare a shared event in
MyClass1 taking the sender object as an argument so you don't need to attach
a handler for each single object.


Armin
 
Hi all,

I had the insertions and deletions handled in a class which had the
colllection as a member.
So i ended up adding the AddHandler and RemoveHandler in the public
Add/Remove methods of the class.

Thanx all for help.
rawCoder
 
Back
Top