Guest User

Untitled

a guest
Aug 20th, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 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(CheckBox checkBox, ref int value)
  16. {
  17. int tag = Convert.ToInt32(checkBox.Tag);
  18. value = checkBox.Checked ? value + tag : value - tag;
  19. return value.ToString();
  20. }
  21.  
  22. private void CheckBox_A_Click(object sender, EventArgs e)
  23. {
  24. textBox1.Text = JHandler((sender as CheckBox), ref a);
  25. }
  26.  
  27. private void CheckBox_B_Click(object sender, EventArgs e)
  28. {
  29. textBox2.Text = JHandler((sender as CheckBox), ref b);
  30. }
  31.  
  32. private void CheckBox_C_Click(object sender, EventArgs e)
  33. {
  34. textBox3.Text = JHandler((sender as CheckBox), ref c);
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment