Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Memory Variable problem
Message
De
20/03/2002 06:19:35
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
20/03/2002 01:16:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00634629
Message ID:
00634846
Vues:
19
I don't know how well you know form properties, so I will briefly explain here.

A variable declared in a method (with LOCAL) is only visible within this method. As soon as the method finishes running, the variable dissapears.

A form property is available in all methods of the form. However, unlike a global (public) variable, it is only defined for the form.

To create form properties, give the menu command Form | New Property. Let's assume you create a property called MyProperty.

To access or change the property, use ThisForm.MyProperty within the form.

To access from a menu or toolbar, use _vfp.ActiveForm.MyProperty (to access properties of the form that is currently on top).

All of the above applies almost identically to Class properties.


OTOH, I am suspecting that what you are trying to do is save data to variables before saving to disk. It is simpler to set the ControlSource of a TextBox directly to the field on disk. Enable buffering on the table or view; use TableUpdate() to save changes, and TableRevert() to un-do changes.

HTH, Hilmar.

>Hi Hilmar,
>Thanks for writing. As far as concern about making indivisual property I could not get how I can solve through form property. Could you give me some detail. how to handle through form property..please...
>
>Situation is I am having almost 50 types of variable for one form which is being used at different text..combo..grid...dtpicker...all type of component is used in form. Somany text using other text memory variable for certain validation. After input all information user pressing save button at that time also some validation required than updating almost 10 table. from memory vaiable.
>
>If I am running form directly its working fine without any error but if i call form through menu/prg its giving some time error at different different text. I tried many time to read all code which calls this form but no any clue.
>
>Solution please.
>
>TIA
>>>Hi,
>>>
>>>I am declaring all variable in .prg and after declaration calling form.
>>>At some text when pressing enter its accepting validation but at some text saying not found. If I am putting one linebefore validation at erroneous text like" Varname=Thisform.text1.value
>>>Than its working perfectly.
>>>Is declaring all variable for particular form in one .prg is ok or should I use some other way. Please guide.
>>>
>>>Thanks in advance,
>>
>>If you declare a local variable in a form, they are only visible in the procedure where you declare it - not in the form. Private variables should be visible also in forms you call from the PRG.
>>
>>To keep things tidy (orderly), you should usually declare all variables in the function or method where they are used. If you need a variable in several methods in a form, use a form property instead (ThisForm.MyProperty).
>>
>>HTH, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform