Guest User

Untitled

a guest
Aug 20th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. using System;
  2. using System.Windows.Forms;
  3.  
  4. namespace WindowsFormsApplication1
  5. {
  6. public partial class Form1 : Form
  7. {
  8. public int a, b, c;
  9.  
  10. public Form1()
  11. {
  12. InitializeComponent();
  13. }
  14.  
  15. private string JHandler(object sender, ref int value)
  16. {
  17. CheckBox checkBox = sender as CheckBox;
  18. int tag = int.Parse(checkBox.Tag as string);
  19. value = checkBox.Checked ? value + tag : value - tag;
  20. return value.ToString();
  21. }
  22.  
  23. private void CheckBox_A_Click(object sender, EventArgs e)
  24. {
  25. textBox1.Text = JHandler(sender, ref a);
  26. }
  27.  
  28. private void CheckBox_B_Click(object sender, EventArgs e)
  29. {
  30. textBox2.Text = JHandler(sender, ref b);
  31. }
  32.  
  33. private void CheckBox_C_Click(object sender, EventArgs e)
  34. {
  35. textBox3.Text = JHandler(sender, ref c);
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment