Simple checkBox question

Posted on 2004-04-28
Last Modified: 2010-04-15
I have the following checkBox I am trying to display on my form but it show unchecked even though the data shows checked.


Any idea hoew to get it to properly display?

Question by:Jimbo456
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 21

Accepted Solution

tovvenki earned 250 total points
ID: 10945852
If the datareader["Active"] is a bit or boolean then assign it straight to the Checked property of the checkbox and not to the text property.
 or if the datareader returns a string like Checked then
if (checkBox1.Text == "Checked")
      checkBox1.Checked = true;
      checkBox1.Checked = false;


Expert Comment

ID: 10948564
You should not be setting the Text property at all.  This property is used as a label to the check box.  Link Venki said, you need to set the Checked property directly.  I would set the Text property to something more descriptive because it is something that the user will see.

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adding items to a C# list incrementally 5 64
Coding for the first time 9 70
parse string in c# 5 29
Web page design problem 3 18
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question