here it is..

santhosh kapa replied to divya rocks at 12-May-08 02:52

You can do this in the Key_Press event of that particular TextBox in which you want to enters only the a-z.

 

Use this code in the keypress event

 

int ascii = Convert.ToInt16(e.KeyChar);

 

if ((ascii >= 97 && ascii <= 122) || (ascii == 8))

{

e.Handled = false;

}

else

{

e.Handled = true;

}

 

Ascii values of "a" to "z" is 97 to 122. And 8 is ascii vaue of Backspace is used to delete the characters using backspace.


Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  textbox validation - divya rocks  12-May-08 02:46 2:46:51 AM
      here it is.. - santhosh kapa  12-May-08 02:52 2:52:31 AM
          spaces - divya rocks  12-May-08 03:06 3:06:08 AM
              Use keycode as 32 - Sujit Patil  12-May-08 03:10 3:10:06 AM
                  Use keycode as 32 - Sudha Konchada  14-May-08 02:15 2:15:33 AM
              add space ascii - santhosh kapa  12-May-08 03:10 3:10:12 AM
      Hi go thr this - Sujit Patil  12-May-08 03:07 3:07:37 AM
      textbox validation - Masked TextBox Concept - Rakesh Vikram  12-May-08 03:13 3:13:22 AM
      re: TextBox validation - Chirag Bhavsar  12-May-08 03:24 3:24:36 AM
      Check here... - Vasanthakumar D  12-May-08 03:16 3:16:02 AM
      Simple - Rave Rasaiyah  12-May-08 05:16 5:16:37 AM
      Costom control - Rave Rasaiyah  12-May-08 05:18 5:18:23 AM
      see this - Sanjay Verma  12-May-08 05:41 5:41:03 AM
      Textbox validation - Thiru Kumaran  12-May-08 01:45 1:45:19 PM
View Posts