|
-
Apr 11th, 2001, 07:16 AM
#1
Thread Starter
Junior Member
Can i use OCX's with late binding
I am in the process of writing a payroll app that is using ocx's for the employee calculations, however as the legislation changes i need to be able to load more than 1 version of the control
some sample pseudocode for those who remember it.
####################################
Dim control as new control
if year = 2000 then
...
... Load TaxCalcs2000 as control
...
elseif year = 2001 then
...
... Load taxCalcs2001 as control
...
Endif
Control.move 0,0
control.visible = true
####################################
Do i have to include the reference for each control in the app or can i use some sort of createobject method to load the correct control at runtime.
Or would it be more sensible to change the ocx's to dlls, if so, how do i instance the forms from the dlls to display in the app.
Any help would be appreciated. Beer will be provided as soon as i figure out the SMTP protocols to deliver it.
 VB6 Enterprise Edition SP4
 All Windows Operating Systems
 SQL, ADO, ASP
-
Apr 12th, 2001, 04:16 AM
#2
Provided you know the ProgID to the control you want to create, you can do it using the CreateObject function. So to create a command button:
Code:
CreateObject("StdLib.CommandButton")
Of course, working with the controls will always be late bound, which is slower. You can get around this by using IDisp binding which is a form or early binding. Thisrequires you to implment a common interface to each control, and access that control through te interface.
- gaffa
-
Apr 12th, 2001, 08:45 AM
#3
Thread Starter
Junior Member
More Details Please
Thanks for the anwser Gaffa, but it only leads to more questions.
1. Compiled as an OCX or Active.dll
2. Do you have any sample code using IDisp binding, or know where i can find some.
Thanks
Uk-Canuck
 VB6 Enterprise Edition SP4
 All Windows Operating Systems
 SQL, ADO, ASP
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
|