dcsimg
 

Submitted by: Srinath M S(srinath_ms@yahoo.com)

Monday Apr 30th 2018 by Srinath M S

Language: .NET, Expertise: Beginner - Learn how to use the KeyPress event to restrict text input.

Use the KeyPress event to check for the keys pressed. See below for an example:

private void textFirstName_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) 
{
    if ( !( char.IsLetter(e.KeyChar) ) ) 
   { 
      e.Handled = true; 
   } 
}
Home
Mobile Site | Full Site
Copyright 2018 © QuinStreet Inc. All Rights Reserved