|
-
May 1st, 2014, 01:33 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] How do you add Events to a DYNAMICALLY created UC OBJ ?
Hello,
I've got my UserControl, but I'm creating/referencing it on the FLY @ Runtime.
Is there a way for it to support EVENTS without turning it in to a CLASS etc ?
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.

-
May 1st, 2014, 01:43 PM
#2
Re: How do you add Events to a DYNAMICALLY created UC OBJ ?
Look up the VBControlExtender in the manual.
The VBControlExtender object is primarily used when dynamically adding a control to the Controls collection using the Add method. The VBControlExtender object is particularly useful for this purpose because it provides a generic set of properties, events, and methods to the developer. Another feature of the object is the ObjectEvent event which is designed to parse any event raised by a dynamically added control. The example below declares an object variable as VBControlExtender, and sets the variable when adding a control. The example also shows how you can program the ObjectEvent event.
-
May 1st, 2014, 02:15 PM
#3
Thread Starter
Frenzied Member
Re: How do you add Events to a DYNAMICALLY created UC OBJ ?
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.

-
May 1st, 2014, 02:52 PM
#4
Re: [RESOLVED] How do you add Events to a DYNAMICALLY created UC OBJ ?
A link should not be required.
Every legal copy of VB6 comes with the necessary documentation CDs. If you do not have these CDs your copy of VB6 is not legal. It's right in the EULA.
-
May 1st, 2014, 06:33 PM
#5
Re: [RESOLVED] How do you add Events to a DYNAMICALLY created UC OBJ ?
I've got a legal copy of VB6 but I don't have the documentation CD's any more as I lost them. Does that mean that my copy of VB6 is no longer legal?
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
May 1st, 2014, 09:05 PM
#6
Re: [RESOLVED] How do you add Events to a DYNAMICALLY created UC OBJ ?
 Originally Posted by dilettante
A link should not be required.
Every legal copy of VB6 comes with the necessary documentation CDs. If you do not have these CDs your copy of VB6 is not legal. It's right in the EULA.
However, sometimes the install of the MSDN library stuffs up and after a while VS6.0 may fail to realize you actually have the help installed alone with Visual Studios.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
May 2nd, 2014, 08:57 AM
#7
Re: [RESOLVED] How do you add Events to a DYNAMICALLY created UC OBJ ?
What the EULA mentions only covers "transfer rights" when you sell or give away Visual Studio 6.0 or individual separate products like VB6.
-
May 2nd, 2014, 04:51 PM
#8
Member
Re: [RESOLVED] How do you add Events to a DYNAMICALLY created UC OBJ ?
Code:
Option Explicit
' Declare object variable as CommandButton and handle the events.'
Private WithEvents cmdObject As CommandButton
Private Sub Form_Load()
'Add button control and keep a reference in the WithEvents variable'
Set cmdObject = Form1.Controls.Add("VB.CommandButton", "cmdOne")
cmdObject.Visible = True
cmdObject.Caption = "Dynamic CommandButton"
End Sub
'Handle the events of the dynamically-added control'
Private Sub cmdObject_Click()
Print "This is a dynamically added control"
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|