Replace previous declaration (Dim ctlNewControl as Control) with this:
Dim WithEvents ctlNewControl as VBControlExtender
This will add ctlNewControl in objects list (left combo in code view). ctlNewControl will have (in addition to standart VB events, like GotFocus etc.) event, called ObjectEvent. This event will be raised for every standart event with object (in your case, CommandButton - Click, DblClick, MouseDown etc.). In this event write code, similar to this one:
Private Sub ctlNewControl_ObjectEvent(Info As EventInfo)
' Program the events of the control using Select Case.
Select Case Info.Name
Case "Click"
' Handle Click event here.
' Other cases now shown
Case Else ' Unknown Event
' Handle unknown events here.
End Select
End Sub
Refer MSDN article "VBControlExtender Object" for further information (sample is from this article)
Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000) br>
VB (.NET) - what other language do you need in the whole Universe?...