Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Raising Events From Within a Collection

Status
Not open for further replies.

TomHW

Programmer
Sep 8, 2004
100
US
I am writing a class that will be used to emulate an option group, but allowing other controls, such as textboxes, whose events affect the other controls in the group. I have a class called cOptionGroup that contains a collection of instances of class cOption. Each cOption class instance contains one control from the group and hooks into specific events of that control using WithEvents.

Is there any way to raise an event inside cOption and allow cOptionGroup to hook into that event, even though cOption is part of a Collection? I do not want to limit the number of controls allowed inside the group by created a WithEvents variable for a set number of controls. In essence, how can I raise events from each control in my collection?

Any help is greatly appreciated,

Tom
 
I've solved my own problem.

I decided to use a linked list since the use of a collection was only to allow for simple storage of objects and was not necessary to the function of the program. With a linked list, each object in the list can hook into the events of the next object in the list. This allows an event raised by any object to be able to flow down the list, where the event can be processed, and then any changes required to each object can be passed right back through the list. This is probably not the most efficient method, but it does work very well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top