Article ID: 196131
Article Last Modified on 5/13/2003
Dim WithEvents MyCtl As MyUserControl
Event Click()
Private Sub UserControl_Click()
RaiseEvent Click
End Sub
Public Property Get Color() As OLE_COLOR
Color = UserControl.BackColor
End Property
Public Property Let Color(Value As OLE_COLOR)
UserControl.BackColor = Value
End Property
Dim WithEvents MyCtl as UserControl1
MyCtl.Visible = True 'This will cause a compile error.
Dim WithEvents MyCtl As VBControlExtender
Private Sub Form_Load()
Set MyCtl = Controls.Add("Project1.UserControl1", "myctrl")
MyCtl.Move 1, 1
MyCtl.Visible = True
MyCtl.Color = &HFF0000
End Sub
Private Sub MyCtl_ObjectEvent(Info As EventInfo)
MsgBox "This control event was fired: " & Info.Name
End Sub
190670
: HOWTO: Dynamically Add Controls to a Form with Visual Basic 6.0
190153
: INFO: Remove Information About Unused ActiveX Controls
Keywords: kbbug kbctrlcreate kbpending kbactivexevents KB196131