Tuesday, September 11, 2018

How do I fish out the value of a selected radio button in a WinForms app?

This really sucks, but you have to do it like so:

string radioButtonSetting;
if (Foo.Checked) radioButtonSetting = Foo.Text;
if (Bar.Checked) radioButtonSetting = Bar.Text;
if (Baz.Checked) radioButtonSetting = Baz.Text;
if (Qux.Checked) radioButtonSetting = Qux.Text;

 
 

I hope this is my last posting for a while on WinForms. Ha!

No comments:

Post a Comment