private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            sayi = double.Parse(textBox1.Text);

            sayi = sayi * 2;
            string a;
            a = sayi.ToString();
            textBox1.Text = a;

        }

here's a little code.

when I enter a number and click on the checkbox,it multiplies the number by 2.

but when I toggle it, it does the same :D

I want the number back when I tick off the checkbox,what should I do?

Test if the Checked property of the checkbox is true or false and act accordingly.

if cheched then do calculatio and if fals do nothing
use if... else

1.
      private void checkBox1_CheckedChanged(object sender, EventArgs e)
   2.
      {
   3.
      sayi = double.Parse(textBox1.Text);
   4.
       
   5.if(CheckBox1.checked== True)
	{
      sayi = sayi * 2;
	}
   6.
      string a;
   7.
      a = sayi.ToString();
   8.
      textBox1.Text = a;
   9.
       
  10.
      }

solved, thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.