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

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.
LVL 7
brdrokAsked:
Who is Participating?
 
gillgatesConnect With a Mentor Commented:
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
 
aacoolConnect With a Mentor Commented:
Actually, that code should be

if(object.Check == true)
{
//...
}
0
 
gillgatesCommented:
Thats right, but my point is "true" is a string... I was just doing some vb6 earlier today and confused myself.
0
 
brdrokAuthor Commented:
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
 
brdrokAuthor Commented:
i split the points 100:25....hope you guys think it's fair.

thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.