Results 1 to 6 of 6

Thread: MSDN: A tri-value boolean, which can have five values, but only two are supported.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    MSDN: A tri-value boolean, which can have five values, but only two are supported.

    https://msdn.microsoft.com/en-us/lib...ice.12%29.aspx

    This is an actual thing that shows that Microsoft (or some intern a long time ago) does not know the purpose of a Boolean. It's used instead of Booleans all over the place if you do Office automation. (The Office automation api is one massive ***. Pray to deity that you'll never have to build something that automates Office).

    Well it is three states. True, False, and Not Supported.

    Microsoft is already transitioning to quantum computing. We just didn't know that yet.
    - The problem is that they don't know it either.

    Last edited by MikiSoft; Sep 13th, 2015 at 10:54 AM.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: MSDN: A tri-value boolean, which can have five values, but only two are supported

    Well there's VbTriState and Tristate Constants.

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,038

    Re: MSDN: A tri-value boolean, which can have five values, but only two are supported

    The general situation shows up all the time. You have things like the tri-state checkbox, and a Boolean in most DB systems can be in three states if you count Null...which you should, since it's a state.

    Essentially, they are reflecting a reality. I agree that a Boolean technically has only two states, but there are lots of three-state situations and after that it is just a matter of choosing a name.
    My usual boring signature: Nothing

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: MSDN: A tri-value boolean, which can have five values, but only two are supported

    Excellent point regarding Null in DBMS fields.

  5. #5
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: MSDN: A tri-value boolean, which can have five values, but only two are supported

    I usually like to be a Devil's Advocate and explain a sensible way one might end up with this silly API through a series of bad choices that seem harmless at the time.

    I think I'd have to do way too much API research to figure this one out. "True" and "False" make sense in a VB context. "CTrue" is weird, in C 0 is false and everything else is true, so I don't understand why it needed its own special one since VB's True ought to be True in any sensible C environment? "Mixed" vaguely makes sense as the third state, but "Toggle" just confuses me. And they're all "Not Supported".

    All I can figure is they started out with the notion that they needed a boolean parameter for some behavior, but might in the future add a third or even more values. When you design APIs that thousands of people use, you tend to hedge your bets this way to avoid releasing new, potentially confusing and controversial overloads. But it looks like msoTriState should've been at least three separate enumerations rather than this one overused enumeration with private implementation details.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  6. #6
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Re: MSDN: A tri-value boolean, which can have five values, but only two are supported

    Quote Originally Posted by dilettante View Post
    Excellent point regarding Null in DBMS fields.
    Yes we also have nullable? boolean in .NET

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