Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@MartinZikmund
Created January 22, 2019 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinZikmund/712452513468379a0cf9a4c3e00206a1 to your computer and use it in GitHub Desktop.
Save MartinZikmund/712452513468379a0cf9a4c3e00206a1 to your computer and use it in GitHub Desktop.
Handling the TextBox BeforeTextChanging event
private void TextBox_OnBeforeTextChanging(TextBox sender,
TextBoxBeforeTextChangingEventArgs args)
{
args.Cancel = args.NewText.Any(c => !char.IsDigit(c));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment