473,385 Members | 1,324 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Addhandler & Collections

I have a collection of objects. The objects gather data from separate sources. Once they get data they raise an event called GotData. I want the collection to raise an event whenever any of it's items raises an event. I have trimmed down the code to the relevent areas. I figure I have to add a handler for each item added to the collection, but I cannot figure out how the pass the parameter in the GotData event to the collection so it can pass the data in its event.

Class Gette
Event GotData(ByVal TheData As String

Private Sub ShowData(ByVal SomeData as String
RaiseEvent GotData(SomeData
End Su

End Clas

Class GetterCo
Dim col As New Hashtabl
Event GotSome(ByVal TheData as String

Public Sub AddGetter(ByVal key as String, ByVal itm as Getter
col.Add key, it
AddHandler itm.GotData, AddressOf RaiseDataEvent(???
End Su

Private Sub RaiseDataEvent(???
RaiseEvent GotSome(???
End Su

End Class
Nov 20 '05 #1
2 1259
"bdring" <an*******@discussions.microsoft.com> schrieb
Class GetterCol
Dim col As New Hashtable
Event GotSome(ByVal TheData as String)

Public Sub AddGetter(ByVal key as String, ByVal itm as Getter)
col.Add key, itm
AddHandler itm.GotData, AddressOf RaiseDataEvent(???)
AddHandler itm.GotData, AddressOf RaiseDataEvent
End Sub

Private Sub RaiseDataEvent(???)
Private Sub RaiseDataEvent(ByVal TheData As String)
RaiseEvent GotSome(???)
RaiseEvent GotSome(TheData )
End Sub

End Class

Don't forget to call RemoveHandler when the item is removed from the
collection.
--
Armin

Nov 20 '05 #2
Yes, I know...thanks. There is a lot of missing code. I trimmed it down to the problem area.
Nov 20 '05 #3

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

Similar topics

2
by: wael radwan | last post by:
how to customize the serialization of a collection that inherited form CollectionBase i.e making the class implementing ISerializable interface because when deserializing using the desrializing...
2
by: Marc | last post by:
Given a class 'Invoice' with a property 'public IMyColl<IInvoiceLine> InvoiceLines' where 'IMyColl<T> : IList<T>' i would like to detect by reflection that 'InvoiceLines' is a...
1
by: Teemu Keiski | last post by:
Hi, I have following type of scenario (also explained here http://blogs.aspadvice.com/joteke/archive/2005/01/10/2196.aspx ) We have problematic web server (wink2 Standard, 1.5GB of physical...
2
by: Just Me | last post by:
When a document is to be printed I call a method that contains an AddHandler statement. I just realized that if a second copy is to be printed the method is called and the AddHandler is executed...
3
by: Trammel | last post by:
Hi, I recently upgraded to VB.net from VB6.. and woah... I feel lost :¬O One of my reasons for upgrading is I was told that VB.net can do class inheritance and subclassing easier. ...
4
by: nhmark64 | last post by:
Hi, Does System.Collections.Generic.Queue not have a Synchronized method because it is already in effect synchronized, or is the Synchronized functionality missing from...
21
by: bearophileHUGS | last post by:
Once in while I too have something to ask. This is a little problem that comes from a Scheme Book (I have left this thread because this post contains too much Python code for a Scheme newsgroup):...
2
by: Terry Olsen | last post by:
I have an array filled with counts of numbers. Example: ar(1) contains the number of occurrances of the number 1 ar(2) contains the number of occurrances of the number 2 etc... I need to find...
7
by: Scott Stark | last post by:
Hello, I've got some code working but I'm not sure that the way I implemented it is the best way. I have a custom collection class with a boolean property HasChanged that tells me if any of the...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.