How to set an event handler for a lower class radiobutton ? (moved from VC++ forum)
**Note : I followed people suggestion to move the question from Visual C++ & C++ Programming > Visual C++ Programming to here.
I create a user control group sub-class. There are two radiobuttons. I need to create event handlers for them.I create event handlers in the sub class and let the event handler to change a constant in the subclass. I will use a function to check the sub class constant in the upper class. Note I have commented out two lines (they are the event handler creation) because they are wrong because they create errors please help.
Re: How to set an event handler for a lower class radiobutton ? (moved from VC++ foru
So, after having a look at your code, you seem to want to attach an event handler that is a member function of temp_groupbox to the radio buttons hosted by the temp_groupbox instance.
Your attempt didn't work for two reasons: (1) Your syntax for the event handler delegate construction is wrong. But much more important: (2) The two event handlers you want to attach aren't defined at all, so that would never have worked at all anyway!
For testing I attached a single event handler to both radio buttons that instead of changing a constant (which would, by the nature of constants, be impossible anyway ) sets the temp_groupbox::Text property, i.e. the group box' caption, equal to the Name property of the button that got checked.
Here is, exemplarily, the statement to attach the event handler to the first button: