Advertisement
BojidarDosev

Untitled

Dec 5th, 2021
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WinFormsApp1
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void label1_Click(object sender, EventArgs e)
  21. {
  22.  
  23. }
  24.  
  25. private void textBox1_TextChanged(object sender, KeyPressEventArgs e)
  26. {
  27. if ((e.KeyChar >= '0') && (e.KeyChar <= '9')) return;
  28. if (e.KeyChar == '.') e.KeyChar = ',';
  29. if(e.KeyChar == ',')
  30. {
  31. if (textBox1.Text.IndexOf(',') != -1) e.Handled = true;
  32. return;
  33. }
  34. if (e.KeyChar == (char)Keys.Enter)
  35. {
  36. button1.Focus();
  37. return;
  38. }
  39. e.Handled = true;
  40. }
  41. }
  42.  
  43.  
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement