Results 1 to 6 of 6

Thread: Differentiating between CDbl(0) and Nothing

Hybrid View

  1. #1
    New Member
    Join Date
    Feb 2011
    Posts
    1

    Re: Differentiating between CDbl(0) and Nothing

    Just make your "Double" variable a "String" and then you can check to see if it is "Nothing" and when you need the "Double" value you can convert it or cast it... VB is usually very forgiving and will perform the cast implicitly for you.

    Dim myDbl as String

    If myDbl <> String.Empty Then....

    OR

    If myDbl IsNot Nothing Then....

    OR

    If myDbl <> Nothing Then....

    AND THEN

    myDbl = "12.99"

    Dim myBool as Boolean = SomeFunctionThatTakesDouble(CDbl(myDbl))
    ' again you could probably pass a String and VB will do the cast here
    ' but this is just a basic example.

    Shawn
    Last edited by si_the_geek; Feb 7th, 2011 at 06:19 PM. Reason: removed advertising link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width