• Not Answered

IF....Then in VBA script for the graphic button

Hello,

I would like to use an Internal Boolean parameter in the VBA script for the IF...function. Is there any suggestion or the below will work:

If DVSYS.MODULE/PARAMETER.F_CV = False Then
msgOper = "The parameter is False"
Else
msgOper = "The parameter is True"
End If

2 Replies

  • Hi Morreira

    It may works, but .implicit conversion could give some strange behavior.

    For example, this code will return False because the converted Integer value for True is -1

    If 1 = True Then
         Debug.Print "True"
    Else
         Debug.Print "False"
    End If

    The best practice is to explicitly convert data type.

    This code will return True :

        If CBool(1) = True Then

    Jack

  • In reply to Jack_France:

    Thanks Jack...

    Do I need for example to initialize the DVSYS.MODULE/PARAMETERAAAAA.F_CV as a especial variable?

    Private Sub CommandButton_Click()
    Dim msgOper As String
    If DVSYS.MODULE/PARAMETERAAAAA.F_CV = False Then
    msgOper = "MESSAGE 1"
    Else
    msgOper = "MESSAGE 2"
    End If

    If (frsCheckForConfirmation(True, "Confirm to Proceed...", msgOper)) Then
    ToggleDigitalPoint "DVSYS.MODULE/PARAMETERBBBBB.F_CV"
    End If
    End Sub