Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make usercontrol to behave as radiobutton

Tags:

c#

.net

winforms

i am developing tab button as user control, how can i make it to behave as radiobutton. "When the user selects one option button (also known as a radio button) within a group, the others clear automatically". thank you.

like image 528
volody Avatar asked Jan 30 '26 03:01

volody


1 Answers

Say your custom Tab button Control is named MyTabButton, Override and implement Equals, and then in the Click event handler in your custom control class,

if (this.Checked)
   foreach(Control myBut in Parent.Controls)
       if (myBut is MyTabButton && !myBut.Equals(this))
          myBut.Checked = false;
like image 147
Charles Bretana Avatar answered Jan 31 '26 16:01

Charles Bretana



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!