Solved

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

Posted on 2004-10-20
5
1,472 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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