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 7010129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:57:05+00:00 2026-05-27T21:57:05+00:00

Straightforward question: I have a few variables that are doubles. I would like to

  • 0

Straightforward question: I have a few variables that are doubles. I would like to be able to store a “null” state in them, i.e. I need to be able to represent that the variable doesn’t contain valid data. I’d really rather not associate a boolean “is valid” variable with every single double, that would be ugly and likely unnecessary.

First, I found out that one has to declare the variable differently to allow the concept of ‘IsNothing’ to be checked, so I do this:

dim someDouble as Double?

(Note the question mark). If I don’t declare it like that, the error check gives me a “IsNot requires operands that have reference types” message.

Once declared, setting the variable to…

someDouble = Nothing

…seems to set it to zero, because it never runs the code in my if/else statement that checks whether someDouble IsNot Nothing… which is bad because the variable can legitimately store a 0 as a valid piece of data.

What am I missing here? Thanks!

EDIT: I left out that I was using properties in a class to Get and Set these values. It turns out I was doing things right except I left my Property‘s type as a Double instead of a Double? so it was casting back to zero instead of the Nothing value. Useful information still in the answers below, though!

  • 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-05-27T21:57:06+00:00Added an answer on May 27, 2026 at 9:57 pm

    you should go read on Nullable Structure on MSDN

    this will explain how to use it

    example:

    Sub Main()
        Dim someDouble As Double?
    
        someDouble = Nothing
        If someDouble.HasValue Then
            Console.WriteLine(someDouble.ToString)
        Else
            Console.WriteLine("someDouble is nothing / null")
        End If
        Console.Read()
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think this is a fairly straightforward question but I have not been able
We have a data model that has some requirements. I would like to find
I have a pretty straightforward question. Is it ok to store plugin DLLs in
My question is pretty straightforward: You are an executable file that outputs Access granted
I need to be able to store a large list of ordered items in
So pretty straightforward question. I have a c# .dll with a whole lot of
I have a few lists that are displayed as inline-blocks, creating the illusion of
--EDIT-- I believe this is a valid question that may have multiple answers (as
We have a process that runs a few times a day (via a Windows
I have to print a 5x5 table with alphabets in them, like: <table> <tr>

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.