Click here to Skip to main content
11,922,641 members (32,106 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
Hello all,

here's a pretty simple question I guess:

I added user settings to a couple of checkboxes for my WinForm following this MSDN article:[^]

I use VS 2012 Express for Desktop.

There's an easy way to add a setting for a control by choosing "new" in the application settings properties of the control. This is what I did, and it works as expected: All checkboxes remain their last state when the form loads.

BUT: the checkboxes toggle the visibility of some labels when the CheckedChanged event occurs:

private void cbExample_CheckedChanged(object sender, EventArgs e)
            lblLabel.Visible = cbExample.Checked;            

When the form first loads, the checkboxes are checked, but the labels remain invisible until I manually uncheck and check the cb again.

What's the proper way to make sure all checked checkboxes, radio buttons and so on do what they should right away?

Thanks for your support,
Posted 2-Jan-13 0:04am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

When the form loads, the event cbExample_CheckedChanged is not called (it only gets executed when checkbox is clicked), so the label remains invisible.

You need to do this in form load event.
Tadit Dash 2-Jan-13 5:41am
No you don't need to call cbExample_CheckedChanged manually, that is the inbuilt event for checkbox.
You just need to write the codes which you want to execute inside the form load.

Write something like below inside the form load event, but don't call the event....

lblLabel.Visible = cbExample.Checked;
Tadit Dash 2-Jan-13 6:03am
For this, please check CheckBox.DoubleClick Event and try to implement the codes inside this event.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


The check change event attach after set of initial values, which you can set from property window.

So the event is not firing.

If you know what is you initial values are then you can easily set which label's you want to visible.


You can set you default value after
function. Then event will fire.

Smile | :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Alright, thanks; so do I have to call every single cb*_CheckedChanged manually in the form load event?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151125.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100