2
I have the following piece of code that limits a TextBox
receivable only numbers and comma:
private void txtTempoAcel1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && e.KeyChar != (char)8 && e.KeyChar == 48)
e.Handled = true;
}
But I have several TextBox
and would like to replicate this code for everyone. Is there any way I can replicate this validation for all TextBox
without me putting that code in the event KeyPress
of each of them ?