|
-
Jan 30th, 2002, 10:43 AM
#1
Thread Starter
Frenzied Member
ActiveX Control
I created an Activex Control.
In my application I did not added it to the toolbox. I'm creating it dynamically. This is the code I use:
VB Code:
Dim WithEvents objExt As VBControlExtender ' Declare VBControlExtender variable
Private Sub LoadControl()
Licenses.Add "MyControl.Control"
Set objExt = Controls.Add("MyControl.Control", "myCtl")
End Sub
Private Sub extObj_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
Private Sub Command1_Click()
Call LoadControl
End Sub
I can handle the events. However, does anyone know how I can access the methods and properties I created for the control when adding the control dynamically to the form?
I can use access them fine when I add it to the toolbox.
-
Jan 30th, 2002, 11:09 AM
#2
Thread Starter
Frenzied Member
Got it.
VB Code:
Dim WithEvents objExt As VBControlExtender ' Declare VBControlExtender variable
Private Sub LoadControl()
Licenses.Add "MyControl.Control"
Set objExt = Controls.Add("MyControl.Control", "myCtl")
'To call a method
objExt.Object.MethodName(parameteres)
'Cool
End Sub
Private Sub extObj_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
Private Sub Command1_Click()
Call LoadControl
End Sub
-
Jan 30th, 2002, 11:28 AM
#3
Thread Starter
Frenzied Member
Damn, I knew it was too easy.
I'm probably missing something easy but here it goes:
I am able to access properties and methods.
However, I have public enumerations. Does anyone know how I can access those?
Thanks to those who reply.
-
Mar 15th, 2004, 09:31 AM
#4
Hyperactive Member
HAHA! Thank you very much for your solution. had the same problem... Thx...
unfortunately I don't know the answhere to your second question, but I'll probably know when a reply is posted here 
Thx
"Experience is something you don't get until just after you need it."
-
Mar 15th, 2004, 10:12 AM
#5
Originally posted by BShadow
HAHA! Thank you very much for your solution. had the same problem... Thx...
unfortunately I don't know the answhere to your second question, but I'll probably know when a reply is posted here 
Thx
Uhm... I think 2 years is enough time for him to have solved this problem or gotten over it.
-
Mar 15th, 2004, 10:16 AM
#6
Hyperactive Member
Originally posted by mendhak
Uhm... I think 2 years is enough time for him to have solved this problem or gotten over it.
LOL, Yes I've noticed the date after i've posted the reply
"Experience is something you don't get until just after you need it."
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
|