Guest User

Untitled

a guest
Jun 22nd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  2. {
  3. if (!char.IsDigit(e.KeyChar)
  4. && e.KeyChar != (char)Keys.Return
  5. && e.KeyChar != (char)Keys.Back
  6. && e.KeyChar != (char)Keys.Space
  7. && e.KeyChar != ','
  8. && e.KeyChar != '.'
  9. && textBox1.Text.Length > 0)
  10. {
  11. var lines = textBox1.Text.Split(Environment.NewLine.ToCharArray());
  12. if (lines.Count() > 1)
  13. {
  14. e.Handled = true;
  15. }
  16. }
  17. }
Add Comment
Please, Sign In to add comment