Answers for "textbox numbers only window forms"

C#
1

windows form textbox numbers only

private void textBox1_TextChanged(object sender, EventArgs e)
{
    if (System.Text.RegularExpressions.Regex.IsMatch(textBox1.Text, "[^0-9]"))
    {
        MessageBox.Show("Please enter only numbers.");
        textBox1.Text = textBox1.Text.Remove(textBox1.Text.Length - 1);
    }
}
Posted by: Guest on January-31-2021

Code answers related to "textbox numbers only window forms"

C# Answers by Framework

Browse Popular Code Answers by Language