Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to handle nullable values - bool? int? etc...

Posted on 2013-02-05
3
Medium Priority
?
233 Views
Last Modified: 2013-02-06
Language:  C#


Compiler is stopping on this line:

 cbBid1IsComplete.Checked = bid1.BidIsComplete;

Error says:

Error      193      Cannot implicitly convert type 'bool?' to 'bool'. An explicit conversion exists (are you missing a cast?)
0
Comment
Question by:Tom Knowlton
3 Comments
 
LVL 23

Accepted Solution

by:
Roopesh Reddy earned 2000 total points
ID: 38858243
Hi,

Then check for NULL, and assign the value -

if(bid1.BidIsComplete != null)
{
  cbBid1IsComplete.Checked = bid1.BidIsComplete.Value;
}

Open in new window


Hope it helps u...
0
 
LVL 13

Expert Comment

by:Jitendra Patil
ID: 38859564
check for Null Value and try to assing value as below
if(bid1.BidIsComplete !=Null)
{
  cvBid1IsComplete.Checked = true;
}

Open in new window

0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 38861320
Thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

773 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