Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Createobject gets Error Instantiating Object
Message
 
À
02/12/1997 17:41:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00063428
Message ID:
00063986
Vues:
126
>I’ve tried everything and I can’t get CREATEOBJECT to work. I keep getting Error instantiating the object.
>
>Facts
>I opened up a Form I designed (which seems to work fine) in the Form Designer and then did File / Save as Class. Then I gave it a Class name called yellow_card and saved it in a class library called apclases.vcx. It is the only item in the library so far.
>
>In the Classes window of the Project Manager I can see …
>
> - aplclases
> - yellow_card
>
> - wizstyle
>
>I can open the Class Browser and choose aplclases in the Open file dialog, and then actually see the yellow_card class listed there. It has a double arrow ( << ) to the left of its name (whatever that signifies). When I click on yellow_card, I can see its objects listed in the right window of the Class Browser.
>
>I’ve registered the apclases class library in the VFP 5.0 top menu: Tools / Options / Controls – Visual Class Libraries area and you can see Apclases listed there.
>
>The apclases.vcx is located in the same directory as all my files are (tables, forms, etc.).
>
>Actions
>In the Command window when I do …
> set classlib to apclases additive
> oform = createobject(yellow_card)
>I get the Error instantiating the object.
>
>If I don’t do the above set classlib … first and just run the createobject … line, I get this error:
>
> Class definition YELLOW_CARD not found
>
>In research here on the UT there was a message from Gary Winkler dated 8/19/97 in which Gary said he usually found the problem was in - an incorrectly spelled field name in a controlsource. So I tried creating a new Form using the Form Designer with just ONE field on it. I set the DE to a table and dragged one field from the DE to the Form to create the field. Then I saved the Form normally then did a File / Save as Class – just like I did above, into the apclases.vcx. The new class was listed in the Project Manager / Classes and also showed up in the Class Browser just like the above class did.
>But when I go to do CREATEOBJECT on it, exactly the same Error instantiating the object occurs. So it may not be a controlsource problem. I’m operating on a Pentium II with 32 megs of memory so resources should be ample too.
>
>This has me stumped. Any help would be great.
>
>John Fish


John,

In the main of your program do you open all your classlibs? If you are testing
you may need to open it yourself.

SET CLASSLIB TO APSCLASES ADDITIVE
oForm = CREATEOBJECT("yellow_card")

If it can't find it then, check your search path. VFP may not be able to find your classlib to open.

Steve
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform