Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IsNumeric - VFP analogue?
Message
From
23/12/1999 12:20:23
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00307922
Message ID:
00308001
Views:
41
>Hi Ed,
>
>>>You can use the funcion TYPE.
>>>Example:
>>>
>>>IF TYPE(mynumber) = "N"
>>> WAIT WINDOW "IT'S A NUMBER!!!"
>>>ELSE
>>> WAIT WINDOW "IT'S SOMETHING ELSE!"
>>>ENDIF
>>>
>>>
>>>Cheers,
>>>
>>>Ricardo
>>
>>Excuse me it should be:
>>
>>a = "123"
>>TYPE("A") = "C"
>>a = 123
>>TYPE("A") = "N"
>
> That's it. I asked exactly about it and Ricardo helped me. Now look which code I placed in edit valid event:
>

>local lnLines, i, lcString
>lnLines=memlines(this.value)
>store 0 to _mline
>for i=1 to lnLines && Loop through all lines
> lcString=alltrim(mline(this.value,1,_mline)) && each line
> if len(lcString)<>5 or type(lcString)<>'N' && typo occurs!

" 123" or "123 " both are legal and satisfy this condition. So is "-1234".

> =messagebox('You must type only 5 digits in each line!',48,'Error')
> return .f.
> endif
>next
>

>
> Very simple and works fine! As I said, I assume, that there are no more 5-6 lines, which users will type. So, what's the reason to switch? :)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform