Results 1 to 6 of 6

Thread: ?type something like Boolean

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    18

    Angry ?type something like Boolean

    What Im trying to achieve is to make my own
    ?type something like Boolean
    Dim isOn As Boolean

    Enum is wrong I think but it will gave you some idea of what
    VB Code:
    1. Im trying to achieve
    2.  
    3.  Enum State
    4.    isOn = -1
    5.    isOff = 0
    6. End Enum
    7.  
    8. Dim MyState As State
    9. Sub Swichstate
    10. If MyState= isOn Then MyState = isOff Else MyState = isOn
    11. End Sub
    12.  
    13. Enum Size
    14.    Small = -1
    15.    Medium= 0
    16.    Big = 1
    17. End Enum
    18. Dim PlateSize As Size
    19.  
    20. Sub Swicht(PlateOverFlows As Boolean)
    21. If PlateOverFlows = True Then
    22. Select Case PlateSize
    23. Case Small
    24.      PlateSize = Medium
    25. Case Medium
    26.      PlateSize = Big
    27. Case Big
    28.     Get_AtherPlate
    29. End Select
    30. End Sub
    Last edited by lee666; Dec 28th, 2004 at 01:03 PM.

  2. #2
    Banned
    Join Date
    Dec 2004
    Posts
    174

    Re: ?type something like Boolean

    Code:
    Dim isOn as Boolean
    
    isOn = True
    isOn = Not True 'Not True is faster than False

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    18

    Re: ?type something like Boolean

    Now Im realize what Im trying to do

    make my own "vartype"

  4. #4
    Banned
    Join Date
    Dec 2004
    Posts
    174

    Re: ?type something like Boolean

    you cant do that with VB you have to code ASM

  5. #5
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: ?type something like Boolean

    Quote Originally Posted by _visual_basic_
    you cant do that with VB you have to code ASM
    Not in the way he wants it but you can always do something like the following (not sure why but anyway):
    VB Code:
    1. Option Explicit
    2.  
    3. Private Type tStatus
    4.     blnStatus As Boolean
    5. End Type
    6. Dim MyStatus As tStatus
    7.  
    8. Private Sub Command1_Click()
    9.     MyStatus.blnStatus = Not MyStatus.blnStatus
    10.     Check1.Value = Abs(CInt(MyStatus.blnStatus))
    11. End Sub

  6. #6

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