Solved

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

Posted on 2013-02-05
3
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: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

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 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