Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How determine entered value type
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00383408
Message ID:
00383705
Views:
12
>>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.

Jim, you're absolutely right. Actually, this form was designed by my colleague and then I had to just use it. But, of course, I immedeately found this hole in the logic. That's why I thought about dynamically adding a textbox of necessary type in the run-time.

Again, thanks for your help and patience.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform