I have been delving within these forums and out in the www trying to get a handle (excuse the pun) on early binding. Unfortunately, I cannot find the answer to my problem. So, hopefully someone can enlighten me :roll:
I have added ComponentOne's TrueDBList OCX to my project and added an instance of the listbox to a form. The event includes and Interface Despatch statements have been created.
In my code I am setting the following -
Dim oList As TrueDBList70TDBList
Dim vColCount as Variant
...
oList = TrueDBList70TDBList In $PROGID_TrueDBList70TDBList
Object Get oList.Columns.Count To vColCount
The above code doesn't create an object. However, if I use -
oList = New TrueDBList70TDBList In $PROGID_TrueDBList70TDBList
it does create one, but I need to refer to the listbox already placed on the form, not create a new one.
If I use the following statement I can refer to my listbox, but it uses the dispatch variable which I don't really want to use (unless this is the way!) -
Set oList = DISPATCH_FRMTEAMS_OCXTBLIST
How do I relate to my control to an object variable in this scenario? Am I missing something obvious? :?
Quote
In my code I am setting the following -
Dim oList As TrueDBList70TDBList
Dim vColCount as Variant
...
oList = TrueDBList70TDBList In $PROGID_TrueDBList70TDBList
Object Get oList.Columns.Count To vColCount
The above code doesn't create an object.
Of course not. This is to connect to an out-of-process server already running.
Quote
However, if I use -
oList = New TrueDBList70TDBList In $PROGID_TrueDBList70TDBList
it does create one, but I need to refer to the listbox already placed on the form, not create a new one.
If I use the following statement I can refer to my listbox, but it uses the dispatch variable which I don't really want to use (unless this is the way!) -
Set oList = DISPATCH_FRMTEAMS_OCXTBLIST
You can use DISPATCH_FRMTEAMS_OCXTBLIST to do the calls (late binding). However, if you insist in using an object variable instead of a dispatch variable, although using a visual control like TrueDBList you won't notice any difference, you can do:
Dim oList As TrueDBList70TDBList
Dim vObj AS VARIANT
Set vObj = DISPATCH_FRMTEAMS_OCXTBLIST
Set oList = vObj
vObj = EMPTY
Now you should be able to use oList instead of DISPATCH_FRMTEAMS_OCXTBLIST.
Thanks for the speedy reply, Jose