Solved

"string was not recognized as a valid boolean"  datagrid checkbox

Posted on 2004-10-20
5
1,480 Views
Last Modified: 2008-01-09
Hello,

I have a checkbox in my databound datagrid.  however, when attempting to change the checkmark, I get the following error:

string was not recognized as a valid boolean.

anyone here know how to resolve this issue?

thanks in advance.
0
Comment
Question by:brdrok
[X]
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
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
gillgates earned 100 total points
ID: 12361429
are you saying...


if object.Check = "true"
{}  

if so, say

if object.Check = true
{}


Same with false, "true" is a string, true is boolean.

if that is not the issue post some code.
0
 
LVL 3

Assisted Solution

by:aacool
aacool earned 25 total points
ID: 12361498
Actually, that code should be

if(object.Check == true)
{
//...
}
0
 
LVL 3

Expert Comment

by:gillgates
ID: 12361514
Thats right, but my point is "true" is a string... I was just doing some vb6 earlier today and confused myself.
0
 
LVL 7

Author Comment

by:brdrok
ID: 12362276
Hello

thanks for the answers.  the answer pointed me in the right direction....

my original code was

//creating column
System.Windows.Forms.DataGridBoolColumn dbc = new DataGridBoolColumn();
dbc.TrueValue = "Yes";  //-----> changed it to dbc.TrueValue = true;
dbc.FalseValue = "No";  //-----> changed it to dbc.FalseValue = false'
tableStyle.GridColumnStyles.Add(dbc);
tableStyle.GridColumnStyles[1].HeaderText = "Scaled?";
tableStyle.GridColumnStyles[1].MappingName = myDataSet.Tables[0].Columns["Scaled"].ColumnName;


0
 
LVL 7

Author Comment

by:brdrok
ID: 12362308
i split the points 100:25....hope you guys think it's fair.

thanks
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

696 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