Textbox only accepting numbers in C# windows application.


private
void txtZip_KeyPress(object sender, KeyPressEventArgs e)
{
if (char.IsDigit(e.KeyChar) || char.IsControl(e.KeyChar))
{
e.Handled =
false;
}
else
{
e.Handled =
true;
}
}