I would like to save the user radio- button preference in the Settings
file.
Therefore, I have created a setting property called radioButtonIsChecked
boolean typed.
radioButton.Checked = Properties.Settings.Default[radioButton.Name + "IsChecked"];
When I try the code above I get an error that object cannot be converted to bool.
I understand the reason is that the returned value from Settings.Default indexer is object.
Is there a way to refer the settings- property type when retrieved from by-name-indexer?
Assuming the retrieved value will be of the right type, just cast it:
radioButton.Checked = (bool) Properties.Settings.Default[radioButton.Name + "IsChecked"];
See more on this question at Stackoverflow