- You First Have To Go To The Properties Of The Textbox And Find For The Event Keypress And Double Click The Event Then You Will Get A New Event Like Below ..
private void textbox1_KeyPress(object sender, KeyPressEventArgs e)
{
}
- Now All You Have To Copy The Code Below And Paste It Inside The Event Function...
char keypress = e.KeyChar;
if (char.IsDigit(keypress) || e.KeyChar == Convert.ToChar(Keys.Back))
{
//eventChecker("T");
}
else
{
e.Handled = true;
}
- And It Should Look Like This .. When Done..
private void textbox1_KeyPress(object sender, KeyPressEventArgs e)
{
char keypress = e.KeyChar;
if (char.IsDigit(keypress) || e.KeyChar == Convert.ToChar(Keys.Back)){
//eventChecker("T");
}
else
{
e.Handled = true;
}
}
No comments:
Post a Comment