mercredi 24 février 2016

C# How to test if a particular radio button is checked and execute some code in if clause

Long story short part of my software is to have 4 radio buttons. I have to know if one of them is checked on some other button click.

The part of the code that I am using

next_btn_Click { if (rb_answer_1.Checked = true){ ...some code... } }

So what happens. When I run the win form and press the mentioned next button if none of the 4 radio buttons are selected, the form selects the 1st one. If any other radio button is selected the form deselects it, selects the first one and executes the "...some code..." please help me with a suggestion how to fix it. Thank you all very much !

Aucun commentaire:

Enregistrer un commentaire