Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with CreateObject 2

Status
Not open for further replies.

MEGUIA

Programmer
Sep 26, 2001
62
PR
Good Morning

I got a library created in visual basic and I want to use it in a VFP 8.0 program. I always create andf load the object in VB 6.0 like this:

VB.
Dim x As Library.libclass
Set x = New Library.libclass
x.MyMethod

(In VB work's)

Now I'm instanciating the class in VFP 8.0 like this:

VFP

x = createobject("Library.libclass")
x.MyMethod
(It doesn't work)

The problem it's that I see the properties of the object but not the methods.

Any help would be great.

Thank You.
 
MEGUIA,

Your code looks perfectly OK to me.

If you are using VFP 7.0 or above, try running the code in the command window. When you type x., you will see a list of all the properties and methods of the object. Is the method you are looking for present in that list? If not, there is something wrong with the control (or the documentation). If it is present, you should be able to execute it. Are you sure it is not working?

Mike


Mike Lewis
Edinburgh, Scotland
 
Hi

Try this..

oNew = NewObject("myObjClass","myPath\myClassLibrary")
oNew.MyMethod()

This is different from createobbject in that, you can use a VCX in NewObject, while the CREATEOBJECT is more convenient if the class definition is followed in the same piece of PRG.

OR

SET CLASSLIB TO myClass.vcx
oNew = CREATEOBJECT("myClassInMyClassLibrary")

This will also do the same job.

:)

____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
Ramani,

oNew = NewObject("myObjClass","myPath\myClassLibrary")

Surely, Meguia is working with a COM object (he said it was written in VB). Why should the location of a classlib or PRG be relevant?

Mike


Mike Lewis
Edinburgh, Scotland
 
One silly thing to check is that you want to make sure it is registered on the computer.

Run regsvr32 myfile.dll

If this works, you can place code in the startup program to look to see if it is registered. If not, copy it to the system directory and register it. That will handle new computer setups.




Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top