Click here to Skip to main content
15,895,843 members

User settings issue: Checkboxes, radiobuttons, ... need to be clicked twice to change their checked state

WebMaster asked:

Open original thread
Hello all,

I am using user settings to store the checked property of a control. The issue I have is: For example I have two radio buttons on my form. rb1 is checked by default, rb2 is unchecked by default. Now if I click rb2, the checked state of rb1 changes to uncheckedm but rb2 still remains unchecked, too. Only after I click rb2 again (NOT double click), the checked state of rb2 changes to checked.

This must have to do with the settings stuff, when the controls' properties are not bound to a setting they work as they should.

When I get the settings manually instead of "binding" them via the Designer, all is working fine:

C#
rb1.Checked = Properties.Settings.Default.rb1;
            rb2.Checked = Properties.Settings.Default.rb2;


...shows normal behavior of the radio buttons.

So, what do I need to do to use the Designer to apply the settings but having the same result as by doing this manually?


More weird is that for most of the checkboxes I have on my form, this issue does not appear, but still for SOME of them; I can't see any difference in code or properties for those which work and those which don't.

I appreciate any hints and tipps,
Best
Dennis
Tags: C#, .NET (.NET4), Windows Forms

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900