I have 3 text boxes where I should only enter numbers and if a letter is written simply do not show it, as if I had not typed it. For Windows forms
private void TBCausacion_KeyPress(object sender, KeyPressEventArgs e)
{
}
I have 3 text boxes where I should only enter numbers and if a letter is written simply do not show it, as if I had not typed it. For Windows forms
private void TBCausacion_KeyPress(object sender, KeyPressEventArgs e)
{
}
Try adding this to your friend method.
private void TBCausacion_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
}
I hope I help you.
Greetings.