How do I specify a conditional instruction (if ... then)?
The following program illustrates various general features of the Visual Basic (VB, and SVB) language including a conditional instruction.
Sub main
'create a report and make it visible Dim r As New Report r.Visible = True 'evaluate whether or not it's visible 'if it is visible If r.Visible Then
MsgBox "The Report is visible"
'else if it is not visible ElseIf Not(r.Visible) Then
MsgBox "The Report is invisible"
'if nothing above was true then... Else
MsgBox _ "The Report is neither visible or invisible"
'indicate that the If block is done End If
End Sub
To run this program, click the button on the toolbar, press F5, or select Run Macro from the Run menu.
Copyright © 2021. Cloud Software Group, Inc. All Rights Reserved.