I have these groupboxes:

I want to run some code according to checked
In my opinion, it's better if you use RadioGroup instead of GroupBox. If you use radioGroup, you can always find the selected item easily like this:
radioGroup.selectedIndex;
If you design using Windows Forms, I suggest to implement RadioGroup behavior like this (please note that my code is in Java):
for (Component comp:groupBox1.components) {
if (((RadioButton)comp).selected)
return ((RadioButton)comp).value;
}
You can put this code block in a method to return selected radioButton value, and then you can use this value in your SWITCH part.