Jim,
>>My intention was opposite. I want that users type 5 digits only - no dots, commans, minus/plus, etc. Right now I changed my code this way:
>>if len(lcString)<>5 or !IsNumeric(lcString)
>> =messagebox(...)
>> return .f.
>>endif
>Nadya,
>
>If this is user input then stop all this work and do it the easy way,
>
>Set the Textbox InputMask to "99999"
Ok, fourth times the same story :) I said, that I'm using editbox for this input. For Piter sake, don't convince me to switch into textbox+listbox+2 buttons or grid+2buttons. And I still need to place something in the valid method. So, why my 'valid' method is harder, that nobody can accept it? I understand, that since we have not InputMask for editbox, it's worth to verify user's input. As I wrote, it would be nice to have this feature in Editbox and I already wrote about it in VFP7.0 wish list. Same story about Pages visibility.
Anyway, my code works and code itself is simple. I assume, that there would be no more than 5-6 lines, so this code executes in seconds.
>Then in the Valid do this;
>
>
>DO CASE
> CASE INT(VAL(This.Value)) <> VAL(This.Value)
> * Problem somehow got a decimal point it there
> CASE VAL(This.Value) < 0
> * Problem negative number
> CASE LEN(ALLTRIM(This.Value)) < 5
> * Problem didn't fill the field
>ENDCASE
>
>
>They user can't make teh field more than 5 chars because of the InputMask, they cannot enter non-digit characters for the same reason, so the only things you need to check on are in the case list.
Yes, interesting approach. I promise, that next time I will use it. Ok?
If it's not broken, fix it until it is.
My Blog