Not to Allow any special charecters cellNo textbox..

Syedshakeer
Posted by Syedshakeer under C# category on | Views : 3072
Hi..

The Above code is usefull when you dont want to enter any special charecters or charecters in a cellNo textbox..

1.First select your TextBox and clik on Events.
2.Next select and double click on Keypress event and write above code ..

Private void textbox1_KeyPress(object sender,EventArgs e)
{
if(char.IsNumber(e.KeyChar)!=true)
{
e.Handle=true;
}
}
3.if you want to work a BackSpace Key write above code

if(e.keychar=='\u0008')
{
e.Handle=false;

}

Comments or Responses

Login to post response