LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default RaiseEvent from a class contained in a 2nd class collection?

I have two objects: cField and cSink. There are many Fields and
pointers to these are stored in a collection within the cSink objects.
When a change is made in the cField object I need it to trigger an
event in the cSink object. I have this almost correct but although
the fields are being stored in the collection okay the event is only
triggered for the last field that was added. I suspect this has
something to do with my WithEvents declaration in cSink but I'm not
sure what to try next.

My code looks like:

*** cField ***
' Declarations
Public Event FieldStatusChange()
' Routines
Sub DoSomething()
...
RaiseEvent FieldStatusChange
End Sub

*** cSink ***
' Declarations
Private WithEvents AllocatedField As cField
Private p_colAllocatedFields As Collection
'Routines
Public Sub AllocateField(objNewField As cField)
Set AllocatedField = objNewField
'Store a pointer to the new field object in our collection
p_colAllocatedFields.Add AllocatedField
End Sub
Private Sub AllocatedField_FieldStatusChange()
msgbox "Event was triggered"
End Sub


If anyone can help it would be greatly appreciated.

Thanks,
Andrew
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Class or Training Nikki Excel Discussion (Misc queries) 2 January 2nd 09 08:15 PM
Class lists Andmor Excel Discussion (Misc queries) 1 November 22nd 06 05:34 PM
Class Question John T Ingato Excel Programming 2 November 7th 03 12:09 PM
For/Each iteration for collection class Stelio Excel Programming 1 October 31st 03 12:46 PM
Is it possible to set a class member to be another class member? Michael[_21_] Excel Programming 3 October 30th 03 08:28 AM


All times are GMT +1. The time now is 08:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"