[Solved] How do GroupBox’s and RadioButton’s work together? [closed]


It’s hard to say for sure what you’re asking. I think you’re asking how the system knows that it should execute the iconType_CheckChanged method when one of the icon radio buttons is clicked, and how it knows that, for example, the asteriskRadioButton changed.

The answer is in two parts. First, in creating the program in Windows Forms, you hooked up the CheckChanged event handler for each of the radio buttons. So the asteriskRadioButton CheckChanged method contains the value iconType_CheckChanged. That information is added to the partial class that you don’t usually see. It’s in your Form.Designer.cs file in the InitializeComponent method. It looks something like:

this.asteriskRadioButton.CheckChanged += iconType_CheckChanged

You don’t typically see the Form.Designer.cs file. To view it, expand the form node in the Visual Studio Solution Explorer and you’ll see the file listed:

show designer code

The second part of the answer is that when you click the radio button (or when some code changes the state of the radio button), the underlying control machinery calls iconType_CheckChanged, passing a reference to the control that triggered the event in the Sender argument.

solved How do GroupBox’s and RadioButton’s work together? [closed]