Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing spaces from a textbox
Message
De
13/02/2010 15:09:15
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01448981
Message ID:
01449064
Vues:
177
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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform