Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Illegal Redefinition of Variable???
Message
 
À
23/03/2002 15:33:52
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00636472
Message ID:
00636502
Vues:
14
Hi, Ravi!

>>
No, I tie textboxes to varaiables
<<

Why do you do this this way?

The better way to encapsulate all storage (means also all variables) of a form is to store it within the form itself:

- mMedName is declared as property of the form
- ThisForm.mMedName is the ControlSource for Text1.
- If the user enters a new value into Text1, this new value is then inserted into the Prescriptions table, when the Save button is clicked.
INSERT INTO Prescriptions(PresRef, MedName, orderdate, healthnum,;
docnum, docname, physref,PatientNam) ;
VALUES (mTabRef, <b>ThisForm</b>.mMedName, mdate, mHealthNum, mDocnum, mDoctor, mPhysRef,;
	mPatientName)

* Clear the contents of the variable to hold new info
ThisForm.mMedName = ""
The result is the same, but no conflicts with other forms!

BTW: Using such possibilities of encapsulation is one of the important issues of OOP!
From here comes the "Golden Rule" of OOP in VFP: Never more than one PUBLIC variable is allowed, and this one is used for goApp - all other stuff is stored in properties!
SeBaFlu
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform