0
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?

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by anerchy
0

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.
      }
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.