Results 1 to 15 of 15

Thread: keypress in C#

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2008
    Posts
    166

    keypress in C#

    here's my code:

    Code:
     private void keypress_charOnly(object sender, KeyPressEventArgs e)
            {
                
    
                int ascii = Convert.ToInt16(e.KeyChar);
                if ((ascii >= 97 && ascii <= 122) || (ascii == 8) || (ascii >= 65 && ascii <= 90))
    
                    {
                        e.Handled = false;
                    }
                else
                    {
                        e.Handled = true;
    
                    }
                   
             }
    my question is, how can i prevent user to input integer values.
    copy and paste (using mouse) can bypass the keypress event..
    thanks.
    Last edited by hoobas20; May 6th, 2008 at 01:01 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width