Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Toggling Radio Buttons In WinForms

This is what I'm doing and it results in a stack overflow because it just switches back and forth forever.

    private void radioButtonA_CheckedChanged(object sender, EventArgs e)
    {
        radioButtonB.Checked = !radioButtonB.Checked;
    }

    private void radioButtonB_CheckedChanged(object sender, EventArgs e)
    {
        radioButtonA.Checked = !radioButtonA.Checked;
    }

There has to be a better way to do this...

like image 568
sooprise Avatar asked Dec 01 '25 08:12

sooprise


1 Answers

try commenting out all of your code and see if it works the way you want. you don't have to uncheck the other radio buttons in code

like image 181
Beth Avatar answered Dec 03 '25 23:12

Beth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!