Add an If Action

You use this action to add If, Else and Else If conditions.

To use an If action:

  1. Add the action in one of three ways, as explained at the end of Built-In Actions.
  2. With the If block selected on the canvas, use either the visual condition builder or the code condition builder to create the condition. To visually create the condition, click the first field in the blue box and select the variable to compare against a value or another variable. Select the comparison operator using the second filed, and enter the value or variable to compare against in the third field.

  3. To add another condition, click the + Condition button and create the condition as explained in the previous step.
  4. To reorder, delete, or add a condition before or after an existing condition, right-click the condition to bring up its context menu.
  5. To combine the conditions with an AND operator, select all from the True if list. To combine the conditions with an OR operator, select any from the list.
  6. Add the action to take for the If block when the conditions are met. You can either select the block and double-click the action, or drag and drop the action onto the Add Action area. If another action is to follow, double-click the next action or drag and drop it onto the bottom edge of the preceding action.

  7. To add an Else or Else If condition, you have a few options:
    • To add a block with a specific action, from the Action palette, drag an action onto the Create Branch drop area (for the last node) or onto the Create Branch drop line (if it's not the last node).



    • To add an empty Else block at the bottom, right-click the If block and click Add Else.
      • If the If block is the last block, VB Studio adds an Else block.
      • If there’s already an Else-If or Else block after it, VB Studio adds an Else-If block instead.
    • To add an empty block at a specific position, right-click an Else or Else-If block and then:
      • Click Add Else Before to get an Else-If block above.
      • Click Add Else After to get an Else block if there's nothing after, or an Else-If block if other blocks already follow.


    • To duplicate an If or Else If block, right-click the block and click Duplicate. This saves time because you can modify a copied block instead of recreating it from scratch.

      By default, an Else condition is created. To turn it into an Else If, enter a condition for it in the Properties pane.