Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Preview(object sender, TextCompositionEventArgs e)
- {
- var textBox = (TextBox)sender;
- var text = e.Text;
- if (textBox.SelectionStart == 0 && text == "-" || long.TryParse(text, out _)) return;
- e.Handled = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement