I have in my project 5 text boxes.
Every TextBox
should accept only digits.
For that I created a function which takes not prepared text and returns the proper one.
Now I'm wondering if there is any simpler way to perform this action on every TextBox
, on every TextChanged
event without repeating almost same code?
private void TextGoldPack_TextChanged(object sender, EventArgs e)
{
(sender as TextBox).Text = Only_digits((sender as TextBox).Text);
}
private void TextGoldTake_TextChanged(object sender, EventArgs e)
{
//repeat here and on every _TextChanged event
}