Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How determine entered value type
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00383408
Message ID:
00383671
Vues:
16
>Hi Jim,
>
>I already tried to explain the actual problem, perhaps you misunderstood me.
>In a textbox a user enters a value. It's a character type. Now, how can you figure out the actual type of value (what user keeps in mind entering it), e.g.
>lcValue="10/12/1994" (User meant Date, but type(lcValue)="N" and type("lcValue")="C")?
>
>TIA

Nadya,

Basically, I would say you can't. Unless of course you can read the user's mind.

Secondly, again, using TYPE(lcValue) is NOT testing the vlaue of lcValue, it is testing the value of the contents of lcValue. You need quotes aroudn the expression with the TYPE function.
lcVar1 = 123
lcVar2 = "lcVar1"

? TYPE(lcVar2) && N for the contents of lcVar1 123
? TYPE(<strong>"</strong>lcVar2<strong>"</strong>) && C for the contents of lcVar2 "lcVar1"
In addition, how do you deal with the user entering 123 and meaning it to be a string?

I just don't see where I would ever put a textbox that I did not know ahead of time what the data type would be. I can see where I might write some code that didn't know what the data type was, but I can then use the TYPE() or VarType() functions to find out the data type.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform