Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Object is not contained in a form
Message
 
 
À
01/09/2017 11:50:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01653920
Message ID:
01653925
Vues:
49
Hi Thierry,

I believe there is also NewObject method that can be used, so you don't have to set classlib. Other than that, you're absolutely correct.

>using
>
>thisform.oMyClass2 = NEWOBJECT( "MyClass2", "MyClass2Lib.VCX")
>
>thisform.oMyClass2 holds a reference to an object that is not a member of the form
>
>To make it a member you need to use .addObject() instead:
>
>thisform.addObject('oMyClass2', "MyClass2")
>
>
>you need this earlier:
>
>set classlib to MyClass2Lib additive
>
>
>
>>Hi,
>>
>>The title of this thread is the error message I get in this situation.
>>
>>I have a form and a class is dropped on this form. E.g. class MyClass1. It is instantiated with any problem.
>>
>>In the INIT of this form another class is instantiated as follows
>>
>>
>>thisform.oMyClass2 = NEWOBJECT( "MyClass2", "MyClass2Lib.VCX")
>>
>>
>>When when I want to get/reference a property of the MyClass1 in a method of MyClass2, I get error "Object is not contained in a form." The way I reference class MyClass1 in a method of MyClass2 is as follows:
>>
>>
>>thisform.MyClass1.aProperty
>>
>>
>>I thought that since MyClass2 is in the same form that instantiated the MyClass1 I would be able to reference it, but apparently I am wrong. What am I missing?
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform