Consuming event of a class in collection

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
 
A

Armin Zingler

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
 
R

rawCoder

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top