Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing spaces from a textbox
Message
From
13/02/2010 15:09:15
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01448981
Message ID:
01449064
Views:
178
This message has been marked as a message which has helped to the initial question of the thread.
>>Do you know what is wrong in my implementation and what would be the best way to fix it?
>>
>
>Move the code to the textbox Keypress event and use nodefault if space is entered.
>
>Like
>
>
>IF this.lNoSpacesAllowed and nKeyCode=32
>NODEFAULT
>ENDIF
>
Though this only prevents entering spaces. But, unless the previous value is a varchar and has length of zero, it's most probably padded with spaces. The user can click in the middle of these spaces, or just rightarrow over them and still have spaces.

I think that, in addition to this, somewhere in .lostfocus() or .valid(), some cleanup would be required:

this.value=chrtran(this.value, " ", "")

Possibly in the .gotfocus() as well - because if this is an observed problem, then it already happened before, and there are such values in the table. A retroactive cleanup may also be needed, depending on how strict the requirement is.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform