+ 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
2 ответов
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.
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