473,699 Members | 2,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event on an item in a collection

This will be difficult to explain so bear with me. If anyone is
familiar with Tibco Rendezvous and/or Microsoft Messaging, this may
make more sense.

I've created a hierarchy of objects that looks something like this:

Tibco-->Transports-->Transport

Where Tibco is the overall component that owns a collection of
Transports and each Transport is an object of a class.

What I want to be able to do is have an event that will fire at the
Transport level whenever a message is received by the application but
I can't seem to figure out how to add an event to a collection item.
To make this question more generic, I simply want to have an event
attached to a collection item contained inside of a collection.

Here is some code:

public class Tibco : System.Componen tModel.Componen t
{
internal TransportCollec tion transports;

public Tibco()
{
this.transports = new TransportCollec tion();
}

public TransportCollec tion Transports
{
get
{
return this.transports ;
}
}
}

public class TransportCollec tion :
System.Collecti ons.Generic.Lis t<Transport>
{
}

public class Transport
{
private System.String service;
private System.String network;
private System.String daemon;
internal ListenerCollect ion listeners;

public System.String Service
{
get
{
return this.service;
}
set
{
this.service = value;
}
}

public System.String Network
{
get
{
return this.network;
}
set
{
this.network = value;
}
}

public System.String Daemon
{
get
{
return this.daemon;
}
set
{
this.daemon = value;
}
}

public Transport()
{
this.listeners = new ListenerCollect ion();
}

public ListenerCollect ion Listeners
{
get
{
return this.listeners;
}
}
}
What I need is to be able to define an event for the Transport.

Any suggestions?

Mar 25 '07 #1
2 1982
PS

<me**********@y ahoo.comwrote in message
news:11******** **************@ n59g2000hsh.goo glegroups.com.. .
This will be difficult to explain so bear with me. If anyone is
familiar with Tibco Rendezvous and/or Microsoft Messaging, this may
make more sense.

I've created a hierarchy of objects that looks something like this:

Tibco-->Transports-->Transport

Where Tibco is the overall component that owns a collection of
Transports and each Transport is an object of a class.

What I want to be able to do is have an event that will fire at the
Transport level whenever a message is received by the application but
I can't seem to figure out how to add an event to a collection item.
To make this question more generic, I simply want to have an event
attached to a collection item contained inside of a collection.
One common way is to pass the collection as a parameter in the item
constructor. The collection items then call this.Parent.OnM yEvent().
Listeners register to the collection.

PS
>
Here is some code:

public class Tibco : System.Componen tModel.Componen t
{
internal TransportCollec tion transports;

public Tibco()
{
this.transports = new TransportCollec tion();
}

public TransportCollec tion Transports
{
get
{
return this.transports ;
}
}
}

public class TransportCollec tion :
System.Collecti ons.Generic.Lis t<Transport>
{
}

public class Transport
{
private System.String service;
private System.String network;
private System.String daemon;
internal ListenerCollect ion listeners;

public System.String Service
{
get
{
return this.service;
}
set
{
this.service = value;
}
}

public System.String Network
{
get
{
return this.network;
}
set
{
this.network = value;
}
}

public System.String Daemon
{
get
{
return this.daemon;
}
set
{
this.daemon = value;
}
}

public Transport()
{
this.listeners = new ListenerCollect ion();
}

public ListenerCollect ion Listeners
{
get
{
return this.listeners;
}
}
}
What I need is to be able to define an event for the Transport.

Any suggestions?

Mar 25 '07 #2
On Mar 24, 9:04 pm, "PS" <ecneserpeg...@ hotmail.comwrot e:
<meyousikm...@y ahoo.comwrote in message

news:11******** **************@ n59g2000hsh.goo glegroups.com.. .


This will be difficult to explain so bear with me. If anyone is
familiar with Tibco Rendezvous and/or Microsoft Messaging, this may
make more sense.
I've created a hierarchy of objects that looks something like this:
Tibco-->Transports-->Transport
Where Tibco is the overall component that owns a collection of
Transports and each Transport is an object of a class.
What I want to be able to do is have an event that will fire at the
Transport level whenever a message is received by the application but
I can't seem to figure out how to add an event to a collection item.
To make this question more generic, I simply want to have an event
attached to a collection item contained inside of a collection.

One common way is to pass the collection as a parameter in the item
constructor. The collection items then call this.Parent.OnM yEvent().
Listeners register to the collection.

PS


Here is some code:
public class Tibco : System.Componen tModel.Componen t
{
internal TransportCollec tion transports;
public Tibco()
{
this.transports = new TransportCollec tion();
}
public TransportCollec tion Transports
{
get
{
return this.transports ;
}
}
}
public class TransportCollec tion :
System.Collecti ons.Generic.Lis t<Transport>
{
}
public class Transport
{
private System.String service;
private System.String network;
private System.String daemon;
internal ListenerCollect ion listeners;
public System.String Service
{
get
{
return this.service;
}
set
{
this.service = value;
}
}
public System.String Network
{
get
{
return this.network;
}
set
{
this.network = value;
}
}
public System.String Daemon
{
get
{
return this.daemon;
}
set
{
this.daemon = value;
}
}
public Transport()
{
this.listeners = new ListenerCollect ion();
}
public ListenerCollect ion Listeners
{
get
{
return this.listeners;
}
}
}
What I need is to be able to define an event for the Transport.
Any suggestions?- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -
Thanks for the reply. I can see how to make it work in code, however,
I probably should've mentioned that I would like to be able to assign
the event to the collection item at design time. My searching has
told me that I need to write my own design editor to support the
events tab on the property page for each collection item, but I have
yet to find information on how to do that or figure it out myself. If
anyone knows how to do this or knows of a source that explains it, I
would very much appreciate a nudge in the right direction.

Mar 25 '07 #3

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

Similar topics

13
1752
by: DraguVaso | last post by:
Hi, I have a Generic List, for instance: Public MyPersonnesDeContact As New System.Collections.Generic.List(Of clsPersonne) My clsPersonne raises some events, and I want to be able to handle these events. The problem is: when using the WithEvents (Public WithEvents MyPersonnesDeContact As New System.Collections.Generic.List(Of clsPersonne)) I get an error, saying "'WithEvents' variable does not raise any events.".
11
2908
by: Alx Sharp | last post by:
Hello group... I've created a collection class that implements the following interfaces: IBindingList, IList, ICollection, IEnumerable and ITypedList: abstract class DataCollectionBase : IBindingList, IList, ICollection, IEnumerable, ITypedList { private ArrayList innerList = null; private System.Type itemType = null; public DataCollectionBase()
0
985
by: Chrysan | last post by:
I have a popup window, which consist of 2 combobox. The second combobox's(cboCube) item collection will change based on the first combobox's(cboDatabase) event(selectedindex_changed) is fired. And, I do have write such code in code-behind as follow: Private Sub cboDatabase_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboDatabase.SelectedIndexChanged Dim strAdomdConnectionString As String Try
13
3504
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the following issues still exist. The article shows how to find methods on a receiver that match the pattern OnXXXX given the sender. It loops through the sender events and tries to get methods from the receiver that match the pattern. For each one...
1
5810
by: Alex K. | last post by:
Hi all How do I catch an event when list item is deleted from ListBox? Is there such event? Thank you Alex
1
1878
by: Asko Telinen | last post by:
Hi all. I ran into quite strange problem concerning the event raising inside FileSystemWatcher Delete event. First, i would like to describe a bit my environment. I have main GUI application, which uses other class libraries. One lib, called Utils.dll contains custom collection implementation. This simple collection just overrides Add and Remove methods to raise
2
1449
by: planet.creativa | last post by:
There are two classes 1) Key - contains some public variables, one method "Reset" and one event "valuesReset" which is raised by Reset method. 2) Keys - this class is collection of objects of class 'Key' and it is inherited with ReadOnlyCollection(Of key). I'm pasting the code here Class key Public Event valuesReset()
0
1130
by: New Bee | last post by:
Im sure nobody is going to bother answering this, but I can live in hope. I am creating bound columns in the Init event of the page, and this works OK for Edit and Update events because all the cells appear in the e.Item.cells collection. However, if I click on a link which generates a Item Command event, only the static columns appear in this collection despite the columns having been built in INIT.
0
8685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9172
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8908
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4374
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.