Difference between ways of Object creation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Friends
Would like to know what's the difference between creating an object like this:
1) Dim Obj As New aspftp.ASPTFP

And this:
2) Dim Obj As aspftp.ASPFTP
Obj = CreateObject("aspftp.ASPFTP")

Reason I ask is number 1 works for me, but number 2 fails with this error:
"Cannot create activeX component'"

This issue is discussed in other forum, but there is no answer at the end.
Although my problem of "cannot create ActiveX component" is solved, seems
that there will be problem in the future if I use (1) to solve this problem...

Thanks in advance

Tom
 
Dear Tom,
CreateObject() creates and returns a reference of a
COM object. CreateObject can't be used for creating instances of
classes in VB unless those classes are explicitly exposed as COM
components. Make sure that "aspftp.ASPFTP" is explicitly exposed as COM
component.

Regards,
Naveed Ahmad Bajwa
Kalsoft Pvt Ltd
 
Dear Bajoo

Thanks for your reply!! aspftp.ASPFTP is really class in VB and reuse in
VB.NET. May I ask how do I know that whether a component is explcitly exposed
as COM component. I have registered the aspftp.dll to component service
already.
If the problem comes from createObject, then does it means using
Dim Obj As New aspftp.ASPFTP
do not have any problem?

Many Thanks!!:)
 
Back
Top