swattw

Untitled

Jan 1st, 2017
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. using System.ComponentModel;
  2. using System.Data;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Forms;
  8.  
  9. namespace WindowsFormsApplication1
  10. {
  11. public partial class Form1 : Form
  12. {
  13. public Form1()
  14. {
  15. InitializeComponent();
  16. }
  17.  
  18. private void button1_Click(object sender, EventArgs e)
  19. {
  20. if (textBox1.Text != "" && textBox2.Text != "")
  21. {
  22. BigInteger num1 = new BigInteger(textBox1.Text);
  23. BigInteger num2 = new BigInteger(textBox2.Text);
  24. BigInteger num3 = num1.add(num2);
  25. label2.Text = num3.ToString();
  26. textBox1.Text = "";
  27. textBox2.Text = "";
  28. }
  29.  
  30. }
  31. private void KeyPress(object sender, KeyPressEventArgs e)
  32. {
  33. if (!(char.IsDigit(e.KeyChar) || e.KeyChar == (char)Keys.Delete || e.KeyChar == (char)Keys.Back || e.KeyChar == '-' ||
  34. ((Control.ModifierKeys & Keys.Control) == Keys.Control)))
  35. {
  36. e.Handled = true;
  37. System.Media.SystemSounds.Beep.Play();
  38. }
  39. }
  40.  
  41. private void richTextBox1_KeyPress(object sender, KeyPressEventArgs e)
  42. {
  43. e.Handled = true;
  44. System.Media.SystemSounds.Beep.Play();
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment