Cannot implicitly convert type 'char' to 'bool'

Posted by Bravi under ASP.NET on 1/12/2008 | Views : 3654 | Status : [Member] | Replies : 2
if (objuserinfo.Gender = 'M')
rbmale.Checked = true;
else
rbfemale.Checked = true;
above is my code it s throw error like
Cannot implicitly convert type 'char' to 'bool'




Responses

Posted by: Jayakumars on: 9/30/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

yes try bravi code

Cannot implicitly convert type 'char' to 'bool'

means your char datatype did not convert bool datatype.

Mark as Answer if its helpful to you

Bravi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bravi on: 1/13/2008 [Member] Starter

Up
0
Down

i found where i did mistek
we have to write like this...

if (objuserinfo.Gender == 'M')
rbmale.Checked = true;
else
rbfemale.Checked = true;


Bravi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response