Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

characters an spaces only in text box

Status
Not open for further replies.

BundaZSZ

Programmer
Sep 6, 2003
12
RO
HY

its me again whit another simple question
How can i set my text box enter just characters an spaces
whit no signs or anything else

Thanks
 
In the VALID event of the control you could build a routine that processes each character in THIS.VALUE and determines if it is in the set of allowable characters.


lReturnValue = .t.
for j = 1 to len(this.value)
ch = substr(this.value,j,1)
if not upper(ch) $ "ABCDEFGHIJKLMNOPQRSTUVWXYZ "
lReturnValue = .f.
exit
endif
endfor
return lReturnValue



Don


 
OK my friend
but I don't want to let the user to enter nothing else that characters and speces in the TEXT BOX
 
Hi Bunda,

Try this. Put in Keypress event

---------
LPARAMETERS nKeyCode, nShiftAltCtrl
Local lcChar

lcChar = chr(nKeyCode)
If !(lcChar $ 'abcdABCD ')
Wait 'Not allowed!' window nowait
NoDefault
endif
--------

Hope it helps

-- AirCon --
 
OK
i thank you for your help
tonight i will try inthe way you show it to me

I hope that these are the right solution
Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top