Answers for "windows textbox unique characters"

0

windows textbox unique characters

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
    var regex = new Regex(@"[^a-zA-Z0-9\s]");
    if (regex.IsMatch(e.KeyChar.ToString()))
    {
        e.Handled = true;
    }
}
Posted by: Guest on September-18-2020

Browse Popular Code Answers by Language