Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- public int a, b, c;
- public Form1()
- {
- InitializeComponent();
- }
- private string JHandler(CheckBox checkBox, ref int value)
- {
- int tag = Convert.ToInt32(checkBox.Tag);
- value = checkBox.Checked ? value + tag : value - tag;
- return value.ToString();
- }
- private void CheckBox_A_Click(object sender, EventArgs e)
- {
- textBox1.Text = JHandler((sender as CheckBox), ref a);
- }
- private void CheckBox_B_Click(object sender, EventArgs e)
- {
- textBox2.Text = JHandler((sender as CheckBox), ref b);
- }
- private void CheckBox_C_Click(object sender, EventArgs e)
- {
- textBox3.Text = JHandler((sender as CheckBox), ref c);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment