Textbox allow only numbers 1 to 100 c#
private void txtnum3_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsDigit(e.KeyChar) && e.KeyChar != (char)8 && e.KeyChar != (char)13)
{
e.Handled = true;
errorProvider1.SetError(txtnum3, "Input must be a number");
errorCount++;
}
else
{
errorProvider1.SetError(txtnum3, "");
}
}