reverse boolean?

Discussion in 'Questions (Windows Mobile)' started by RB Smissaert, Mar 31, 2009.

  1. RB Smissaert

    RB Smissaert Well-Known Member Licensed User

    Is it possible in B4P to reverse a boolean as you can do in VB, eg:
    txtTest.Visible = (bBool = False)

    It would be useful as you could then reduce the code in procedures like this:

    Sub ShowHidePaymentList(bShow)

    If bShow = True Then
    btnNewPayment.Visible = False
    btnDeletePayment.Visible = False
    btnClearAllP.Visible = False
    btnPractices.Visible = False
    btnPaymentsList.Visible = False
    tblPayments.Visible = True
    Else
    tblPayments.Visible = False
    btnNewPayment.Visible = True
    btnDeletePayment.Visible = True
    btnClearAllP.Visible = True
    btnPractices.Visible = True
    btnPaymentsList.Visible = True
    End If

    End Sub


    RBS
     
  2. Byak@

    Byak@ Active Member Licensed User

    Yes

    btnNewPayment.Visible = not(btnNewPayment.Visible)
     
  3. RB Smissaert

    RB Smissaert Well-Known Member Licensed User

    Yes, I knew that one, but it is not quite the same as reversing a "Boolean" variable. How would you code the posted procedure without the If Else
    construction?

    RBS
     
  4. specci48

    specci48 Well-Known Member Licensed User

    Hi RB Smissaert,

    I would code it like that:
    Code:
    Sub ShowHidePaymentList(bShow)
       tblPayments.Visible = bShow
       btnNewPayment.Visible = 
    Not(bShow)
       btnDeletePayment.Visible = 
    Not(bShow)
       btnClearAllP.Visible = 
    Not(bShow)
       btnPractices.Visible = 
    Not(bShow)
       btnPaymentsList.Visible = 
    Not(bShow)
    End Sub

    specci48
     
  5. RB Smissaert

    RB Smissaert Well-Known Member Licensed User

    Thanks, I am nearly sure I tried that and for some reason it didn't work, but will try again tonight.

    RBS
     
  6. RB Smissaert

    RB Smissaert Well-Known Member Licensed User

    Yes, that works fine.
    I think I had done Not bShow as in VB.
    Thanks again for clearing that up.

    RBS
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice