Article ID: 196131 - Last Review: May 13, 2003 - Revision: 3.0 BUG: Dynamic Private UserControl Extender Events Do Not ShowThis article was previously published under Q196131 On This PageSYMPTOMS
If you declare the variable using early-binding syntax when you dynamically
add an instance of a private UserControl, you cannot see or use any of the
control's extender properties or events. You are only able to see and use
the raw properties and events of the control (that is, those declared by
the control itself).
CAUSE
Visual Basic 6.0 allows developers to dynamically add ActiveX controls to a
form at run time. Typically, a VBControlExtender variable is used for the
dynamically-added control, which performs late binding on the control.
However, if the type of the control is known at compile time, you can
declare the variable using early binding syntax like the following:
However, if MyCtl is a private UserControl, Visual Basic binds directly to the interface for the control itself, bypassing the control extender it normally adds for ActiveX controls. As a result, your code will not see or be able to use any extender properties and events. RESOLUTION
Declare the variable for your dynamically-added control as
VBControlExtender, and Use the extender to access your control late-bound.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
MORE INFORMATIONSteps to Reproduce Behavior
REFERENCES
For additional information, please see the following articles in the
Microsoft Knowledge Base:
190670
(http://support.microsoft.com/kb/190670/EN-US/
)
: HOWTO: Dynamically Add Controls to a Form with Visual Basic 6.0
190153 (http://support.microsoft.com/kb/190153/EN-US/ ) : INFO: Remove Information About Unused ActiveX Controls Visual Basic Books Online: Component Tools Guide; UserControls | Article Translations
|

Back to the top
