Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding Controls At Runtime
Message
From
16/04/2002 12:02:48
 
General information
Forum:
Visual Basic
Category:
ActiveX controls
Miscellaneous
Thread ID:
00645508
Message ID:
00645532
Views:
22
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)

VB (.NET) - what other language do you need in the whole Universe?...

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform