PC Review


Reply
Thread Tools Rate Thread

Addhandler & Collections

 
 
=?Utf-8?B?YmRyaW5n?=
Guest
Posts: n/a
 
      22nd Feb 2004
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
 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      22nd Feb 2004
"bdring" <(E-Mail Removed)> 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

 
Reply With Quote
 
=?Utf-8?B?YmRyaW5n?=
Guest
Posts: n/a
 
      23rd Feb 2004
Yes, I know...thanks. There is a lot of missing code. I trimmed it down to the problem area.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A List of Collections and Custom Collections ExcelMonkey Microsoft Excel Programming 1 20th Dec 2007 10:04 PM
Help in asp.net addhandler =?Utf-8?B?UGllcnJl?= Microsoft Dot NET 5 4th May 2005 04:51 PM
Addhandler help UGH Microsoft ASP .NET 7 30th Nov 2004 02:24 PM
Using AddHandler Rick Palmer Microsoft VB .NET 10 6th Oct 2004 10:15 PM
AddHandler Micke Palm Microsoft ASP .NET 0 12th May 2004 09:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:07 AM.