Public Event Clicked() Public Property Get Caption() As String Caption = cmdButton.Caption End Property Public Property Let Caption(ByVal sNewCaption As String) cmdButton.Caption = sNewCaption End Property Private Sub cmdButton_Click() RaiseEvent Clicked End SubNext, I created a second UserControl called Base. It will contain all
Option Explicit Dim WithEvents ctlButton As VBControlExtender Public MyControls As New Collection Private Sub UserControl_Initialize() Set ctlButton = Controls.Add("TestProj.ctlButton", "ctlButton") With ctlButton .Visible = True .Top = 10 .Left = 10 End With MyControls.Add ctlButton End Sub Private Sub ctlButton_ObjectEvent(Info As EventInfo) Select Case Info.Name Case "Clicked" MsgBox "Button was clicked" Case Else End SelectEverything works fine except this. The MyControls.Add adds