cpopham Posted February 18, 2004 Posted February 18, 2004 I know how to code the e handled procedure to allow only numbers and special characters, but how can you code the keypress event e handled procedure to allow only alphebetical characters without a bunch of or statements? Thanks, Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
samsmithnz Posted February 18, 2004 Posted February 18, 2004 You can check to see if its within the a range using the asc statement. if asc(strCharacter) <= 122 or asc(strCharacter) >= 97 then 'do stuff end if Quote Thanks Sam http://www.samsmith.co.nz
cpopham Posted February 18, 2004 Author Posted February 18, 2004 Would this account for caps or lowercase letters? If lowercase then I could convert the letters from my text box to lowercase? Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
*Experts* mutant Posted February 18, 2004 *Experts* Posted February 18, 2004 This method is much better: If Not Char.IsLetter(e.KeyChar) Then e.Handled = True End If The shared method of the char will tell you if the character is a letter, lower or uppercase. Quote
samsmithnz Posted February 18, 2004 Posted February 18, 2004 hey that IS much better! Quote Thanks Sam http://www.samsmith.co.nz
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.