Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!char.IsDigit(e.KeyChar)
- && e.KeyChar != (char)Keys.Return
- && e.KeyChar != (char)Keys.Back
- && e.KeyChar != (char)Keys.Space
- && e.KeyChar != ','
- && e.KeyChar != '.'
- && textBox1.Text.Length > 0)
- {
- var lines = textBox1.Text.Split(Environment.NewLine.ToCharArray());
- if (lines.Count() > 1)
- {
- e.Handled = true;
- }
- }
- }
Add Comment
Please, Sign In to add comment