Solved

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

Posted on 2013-02-05
3
223 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now