private void ErrorSplash(TextBox text, string message) { text.Focus(); ErrorToolTip.Hide(text); ErrorToolTip.Show("", text); ErrorToolTip.Show(message, text); }
private void SigMaskTextBox_KeyPress(object sender, KeyPressEventArgs e) { if (char.IsControl(e.KeyChar) || Regex.IsMatch(e.KeyChar.ToString(), @"[x?]")) { return; } ErrorToolTip.Show("Only 'x' and '?' are allowed", SigMaskTextBox, 1000); e.Handled = true; }
private void SigMaskTextBox_TextChanged(object sender, EventArgs e) { if (!(sender is TextBox textBox)) { return; } if (textBox.Text.Equals(@"[xx??xx]")) { return; } if (Regex.Matches(textBox.Text, @"[x?]").Count == textBox.Text.Length) { return; } textBox.Clear(); ErrorToolTip.Show("Only 'x' and '?' are allowed", textBox, 1000); }