|
-
August 7th, 2001, 10:51 AM
#1
Instantiating objects from ActiveX dll
This isn't any major problem, I'm just wondering if someone can explain this a little clearer than I understand it...
I have compiled an ActiveX dll that has a couple functions for calculating Time statistics. The class is called TimeStats. When I create an object of that class I have to use
Dim ts as Object
set ts = new TimeStats
Everything works fine from there. I'm just wondering why I can't use..
Dim ts as TimeStats
..because this is legal syntax but gives a run-time error 91 (object not set). Like i said, my code is working and everyone is happy, but can someone explain why I can't dimension the object directly? Thank you!!
Jeff
-
August 7th, 2001, 11:36 AM
#2
Re: Instantiating objects from ActiveX dll
Did you try this:
Dim ts as YourDll.TimeStats
Regards,
Michi
-
August 7th, 2001, 11:40 AM
#3
Re: Instantiating objects from ActiveX dll
Hi, thanks for replying!
I tried that but it still gives the same error. I do have the dll checked in References. My code works just fine if I dim the variable as Object then set it to New TimeStats. I'm just trying to understand why I have to do it that way. Thank you though for the input!
Jeff
-
August 7th, 2001, 11:55 AM
#4
Re: Instantiating objects from ActiveX dll
Have you tried the shorthand:
Dim ts as new TimeStats
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
-
August 7th, 2001, 12:00 PM
#5
Re: Instantiating objects from ActiveX dll
Thanks, that sure works alright- I just still don't understand why the "New" keyword is required.
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
|