Initialize the switch as set

I am having trouble initializing the switch as noted. I mean, when I open the form, none of my 2 radio buttons are checked, but they work fine after I check them. I tried to set one of them as noted in the form constructor, but it still appears as unverified:

public frmPreferences(Capitals capit)
{
    InitializeComponent();
    radEnglish.Enabled = true;
}
+5
source share
2 answers
radEnglish.Enabled = true

This does not set the CheckBox to Checked; it allows you to manage. You can do it in the designer, or you can use the line

radEnglish.Checked = true;

For WPF, this is

radEnglish.IsChecked = true;
+10
source

, () . :

radEnglish.Checked = true;
+4

All Articles