Here is an example code

private void radioButton3_CheckedChanged(object sender, EventArgs e) { if(radioButton1.Checked // как здесь присвоить +1 к переменной result?) } 

But the variable itself is declared (maybe something was wrong there)

 private void textBox1_TextChanged(object sender, EventArgs e) { int result = int.Parse(textBox1.Text); } 

    1 answer 1

    Why do you need to declare result as a local variable? You need to declare it global so that other procedures can work with it. If you really need to result dynamically display every change to a text field, then you need something like this:

     int result; private void textBox1_TextChanged(object sender, EventArgs e) { if (radioButton1.Checked) result = int.Parse(textBox.Text) + 1; else result = int.Parse(textBox.Text); } private void radioButton3_CheckedChanged(object sender, EventArgs e) { textBox1_TextChanged(sender, e); }