Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7747941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:39:21+00:00 2026-06-01T10:39:21+00:00

(using WPF application) I get an error when i want to save a bool

  • 0

(using WPF application)
I get an error when i want to save a bool to a global variable like this:

Window msgOne = new Window();
 if (Properties.Settings.Default.sound01 == true)
  {
    msgOne.radioboxSound.IsChecked = true;
  }
 else
  {
    msgOne.radioboxSound.IsChecked = false;
  }
msgOne.ShowDialog();
//waiting for close
Properties.Settings.Default.sound01 = msgOne.radioboxSound.IsChecked;

where the radioboxSound is the checkbox, and the Properties.Settings.Default.sound01 is the global parameter that you can make in the settings tab in VB c#

The error that i am getting for the last link of above snipit):
Cannot implicitly convert type “bool?” to “bool”. An explicit conversion exist (are you missing a cast?)

But i don’t have used any bool?, only bolls that have been set.

Anyone know how to deal with this one?

thanx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:39:22+00:00Added an answer on June 1, 2026 at 10:39 am

    The radio button’s IsChecked property is a ‘bool?’. Change your code to

    Properties.Settings.Default.sound01 = msgOne.radioboxSound.IsChecked??false;
    

    A bit more explanation.

    Since RadioButton.IsChecked is a Nullable, then regardless of whether the IsThreeState property is set to true or false you will need to handle the fact that IsChecked is nullable.

    You could use

    Properties.Settings.Default.sound01 = msgOne.radioboxSound.IsChecked == true;
    

    or use the null coalescing operator as above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I get the OS details using C# code in my WPF application?
When using FxCop 1.36 for a WPF application with a single window that has
When using fonts for my application I get no warning/error/exception when a FontFamily I
When writing a WPF application using MVVM, I want to use a WCF service,
I'm using Microsoft.Win32.OpenFileDialog in my WPF application for selecting file: var dlg = new
I have a WPF Application using MVVM pattern. I have a Window in my
In my WPF application using MVVM I noticed that in some cases the CanExecute
I am creating a WPF Application using VS 2005. I download the add on
I have a WPF application using Aero Glass. When using the application under a
I am installing a WPF Application using the ClickOnce deployment. There are certain settings

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.