Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where object dropped on form is instantiated?
Message
De
23/02/2010 09:39:35
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01450463
Message ID:
01450475
Vues:
44
>>>>>Hi,
>>>>>
>>>>>I dropped an object (class) on a form. Then in the form LOAD method I check if this object is NULL as following:
>>>>>
>>>>>isnull( thisform.MyObject )     && Returns .F.
>>>>>type( "thisform.MyObject" )   &&  Returns "O"
>>>>>
>>>>>
>>>>>So I presumed that the object is instantiated in the LOAD method of the form. But when I call a method of this object in LOAD method of the form, I get error that the object does not exist. Does it mean that the object is fully instantiated only in the INIT method of the form?
>>>>
>>>>Yes
>>>>
>>>>But you can add the object in the load() of the form prior to using it
>>>
>>>You mean by instantiating the object as the following?
>>>
>>>thisform.MyObject = newobj("MyObjectClass","ClassLib")
>>>
>>
>>
>>yes - or -
>>
>>this.NewObject('MyObject', "MyObjectClass", "ClassLib")
>>
>
>Thank you, Gregory.

>This is what I will have to do. The only downside of this method (not a big deal though) is that I have to set all properties in code, instead of visually.

Welcome to the .net world ..

>Also, I have to set the object to NULL in the UNLOAD whereas if you drop the object it is destroyed automatically.

No, you don't need to. All objects are destroyed automatically
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform