473,734 Members | 2,511 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 1985
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
1758
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
2912
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
991
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
3512
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
5817
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
1880
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
1451
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
1132
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
8946
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
8776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9449
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...
0
9310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4550
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...
1
3261
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
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.