Advertisement
tolikpunkoff

Input digit only in TextBox

Apr 5th, 2016
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.34 KB | None | 0 0
  1. private void txtTextBox_KeyPress(object sender, KeyPressEventArgs e)
  2.         {
  3.             //ввод только цифр
  4.             if (!(Char.IsDigit(e.KeyChar)))
  5.             {
  6.                 if (e.KeyChar != (char)Keys.Back)
  7.                 {
  8.                     e.Handled = true;
  9.                 }
  10.             }            
  11.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement