Event handling for dynamic array of controls
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 Explici开发者_Go百科t
Private WithEvents grid(0 To 23, 0 To 23) As Frame
How can I get the same functionality for this array of controls?
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 sinksFrame
's events - on event it calls a callback method on a "parent" object
- passing
me
as first parameter
- passing
- "parent" substitutes
me
with an integer index and raises an event
Most problematic is cyclic references this scheme is usually implemented with.
精彩评论