I am having problems catching events from the VbControlExtender.
I have an right now just a generic activex control no code or control placed in it and complied it as and OCX.
I then have a project that dynamically loads the the control and want to catch any events that might be fired from the user control. Problem is the extender isn't reporting back any events even a dblclick. Anyone see a problem with why my codes not working.
Private WithEvents EmbeddedControl As VBControlExtender
Private Function CreateControl(ByVal strControlName As String)
If Not EmbeddedControl Is Nothing Then
Controls.Remove "Embedded"
Set Embedded = Nothing
End If
Set EmbeddedControl = Me.Controls.Add("Project1.UserControl1", "Embedded")
EmbeddedControl.Visible = True
End Function
Private Sub EmbeddedControl_GotFocus()
MsgBox "Hey"
End Sub
Private Sub EmbeddedControl_ObjectEvent(Info As EventInfo)
MsgBox Info.Name
End Sub
Private Sub Form_Load()
CreateControl "Test"
End Sub
I have an right now just a generic activex control no code or control placed in it and complied it as and OCX.
I then have a project that dynamically loads the the control and want to catch any events that might be fired from the user control. Problem is the extender isn't reporting back any events even a dblclick. Anyone see a problem with why my codes not working.
Private WithEvents EmbeddedControl As VBControlExtender
Private Function CreateControl(ByVal strControlName As String)
If Not EmbeddedControl Is Nothing Then
Controls.Remove "Embedded"
Set Embedded = Nothing
End If
Set EmbeddedControl = Me.Controls.Add("Project1.UserControl1", "Embedded")
EmbeddedControl.Visible = True
End Function
Private Sub EmbeddedControl_GotFocus()
MsgBox "Hey"
End Sub
Private Sub EmbeddedControl_ObjectEvent(Info As EventInfo)
MsgBox Info.Name
End Sub
Private Sub Form_Load()
CreateControl "Test"
End Sub