views:

16

answers:

1

I found this link to handle events for a dynamically created control in vb6 and I tried to use this for my code, but to no avail.

Option Explicit
Private WithEvents grid(0 To 23, 0 To 23) As Frame
How can I get the same functionality for this array of controls?

+1  A: 

You can't.

You can either use control arrays where you Load new indexes (instances) of your control or write a custom wrapper class that forwards the events through callback methods.

For second option:

  • you have a class cFrameExt that sinks Frame's events
  • on event it calls a callback method on a "parent" object
    • passing me as first parameter
  • "parent" substitutes me with an interger index and raises an event

Most problematic is cyclic references this scheme is usually implemented with.

wqw