+ 1

RadioButton event control

private void rbNormal_CheckedChanged(object sender, EventArgs e) { int amt = int.Parse(txtFee.Text); RadioButton rb = sender as RadioButton; if (rb.Checked ) { amt += Convert.ToInt32(rb.Tag) * count; } else { amt -= Convert.ToInt32(rb.Tag) * count; } txtFee.Text = amt.ToString(); } When ever radio event is unchecked "amt += Convert.ToInt32(rb.Tag) * count;" statement is executed , why it not jump to else condition

5th Nov 2018, 5:24 AM
Red ITWorld
Red ITWorld - avatar
2 Respuestas
0
believe it’s because it’s only processed on clicking the radio button and not when you remove it. so, it activates when checked but isnt called and then run again when it’s unchecked.
5th Nov 2018, 6:32 AM
Panayiotis Spanos
Panayiotis Spanos - avatar
0
How many options do you have in your radiobutton ? A radiobutton has at least one option checked. If you have 1 option, this can't be unchecked. If you want just one option choose a checkbox
5th Nov 2018, 7:58 PM
sneeze
sneeze - avatar