Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing and returning arrays
Message
De
16/03/2002 17:00:29
 
 
À
15/03/2002 15:18:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00633588
Message ID:
00633806
Vues:
16
Well, thanks for everyone's input. It actually gave me several different ways to skin this here cat. Let me back up for a moment... What I was really trying to do was to come up with a way of calling a validation method from another method in my class and getting back an array. The first element of the returned array would have a value of .T. or .F. depending on if the data I passed to the validation method was valid. If it was not valid then I wanted to be able to look at the second element of the array and get the error message and display it to the user. Based on your suggestions I came up with the following solution:

*----------------------------------------------------
* METHOD: MyProc
*----------------------------------------------------
PARAMETERS m.tcStringIn
LOCAL laArray1
DIMENSION laArray1[1,2]
IF ValidString(m.tcStringIn,@laArray1) = .F.
=MESSAGEBOX(laArray1[1,2],16,'Error!')
ENDIF
RETURN

*----------------------------------------------------
* METHOD: ValidString
*----------------------------------------------------
PARAMETERS m.tcString, taArray
DO CASE
CASE TYPE('m.tcString') = 'C' .AND. m.tcString = 'FGHIJ'
taArray[1,1] = .T.
taArray[1,2] = ''
OTHERWISE
taArray[1,1] = .F.
taArray[1,2] = 'STRING MUST BE "FGHIJ"'
ENDCASE
RETURN taArray
Time is a wonderful teacher. Unfortunately it kills all of its students.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform