PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Boolean to Byte Command-VBForums
Results 1 to 3 of 3

Thread: Boolean to Byte Command

  1. #1

    Thread Starter
    Lively Member Daniel McCool's Avatar
    Join Date
    Oct 2002

    Boolean to Byte Command

    Is there a built in VB command that converts a Boolean value into a Byte value? I've made my own function ...
    VB Code:
    1. Private Function bool(ByVal var As Boolean) As Byte
    2.     If var = True Then
    3.         bool = 1
    4.     Else
    5.         bool = 0
    6.     End If
    7. End Function
    ... but I'd prefer to use a built in command. Any? Thanks.
    "Some love is fire, some love is rust. But the finest, cleanest love is lust." - James Bond

  2. #2
    Join Date
    Oct 2002
    British Columbia
    CByte(True) = 255

    ABS(True) = 1

  3. #3
    Join Date
    Aug 2001
    new jersey
    false is held as a zero and true is held as a minus one, so as brucevde has shown, there are numerous ways to use standard VB functions to obtain flavors of the numeric values.

    you could also do

    ival = iif(bval, 1, 0)

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