BUG: Dynamic Private UserControl Extender Events Do Not Show (196131)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q196131 SYMPTOMS
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:
Dim WithEvents MyCtl As MyUserControl
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.
REFERENCES
For additional information, please see the following articles in the
Microsoft Knowledge Base:
190670
: HOWTO: Dynamically Add Controls to a Form with Visual Basic 6.0
190153
: INFO: Remove Information About Unused ActiveX Controls
Visual Basic Books Online: Component Tools Guide; UserControls
Modification Type: | Major | Last Reviewed: | 5/13/2003 |
---|
Keywords: | kbActivexEvents kbBug kbCtrlCreate kbpending KB196131 |
---|
|