Solved

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

Posted on 2013-02-05
3
226 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:knowlton
3 Comments
 
LVL 23

Accepted Solution

by:
Roopesh Reddy earned 500 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 12

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:knowlton
ID: 38861320
Thanks!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

839 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