Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6 - Instantiate Object Multiple Times?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00256420
Message ID:
00256442
Vues:
25
>>>I am using the Registry class that comes with VFP6. I make Registry changes through this. Anyway, I end up doing this:
>>>
>>> #include registry.h
>>> loRegistry = NewObject( "Registry", "Registry.VCX" )
>>>
>>>Once in my form.init, button1.click, and button2.click. I am sure I am wasting memory and maintenance. How can I get this going just one time and call it repeatedly?
>>
>>Add a property to your form, then use it instead of a variable.
>
>? How do I do that?

1 way would be:

Open the form in the form designer and on the menu click Form->New property. In the dialog box give the property a name like oRegistry. If you click the other tag on the property sheet and scroll down to the bottom it should show the new property.

Now in the init of the form add your could to create the object:
this.oRegistry = NewObject( "Registry", "Registry.VCX" )
This will store a reference to the registry object in the property. Now you can access that object with
ThisForm.oRegistry.IsKey()
hth
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform