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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formating text box

Status
Not open for further replies.

augustin

Programmer
Jun 18, 2003
26
0
0
RO
How to create a text box that accepts as input data, only alphabetic and spaces ( for names of persons ).
I tried with KeyPress event but I can not control the keystrokes. More precisely, if a digit is pressed it's displayed in the text box and I don't want this.

e.g. code for txtPerson.KeyPress

LPARAMETERS nKeyCode, nShiftAltCtrl
If ( !ISALPHA(CHR(nKeyCode)) AND nKeyCode != 32 )
Messagebox('Use only alphabetic and spaces!')
EndIf
 
Hi

in the format property of the TextBox put A
This will restrict to only Alpha characters
:)

____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
Try:
Code:
LPARAMETERS nKeyCode, nShiftAltCtrl
 If ( !ISALPHA(CHR(nKeyCode)) .AND. !chr(nKeyCode)$" '-"+chr(27))
     Wait 'Use only alphabetic and spaces!' window nowait timeout 2
     NODEFAULT
 EndIf

Note the allowance for apostrophes and hyphens!

Regards

Griff
Keep [Smile]ing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top