TG - How to change screens using VB script on the NA5

Modified on Thu, 2 Oct at 3:45 PM

Purpose

This guide explains how to change between screens using a Visual Basic Script instead of using the Events and Actions for the NA HMI.



Problem Explanation/Objective

Using Visual Scripts can help when the design needs to fit on a small screen. This is an alternative to the traditional buttons change between screens.



Supported devices

  • NA5-V1 HMI Series



Requirements

  • Sysmac Studio software
  • NA-V1 HMI Series



Procedure


1 - Add all the pages that you will use. In this example, we added 3 pages:




2 - We will use a drop-down menu to change between pages, add a drop-down menu, and assign a variable name to use for the condition for changing pages. Press the + sign to add all the pages that you have created, with the page title: 






3 - Right-click on the Edit Panel for Edit pages and select the option "View Code"




4 - Paste this code in all the pages that will have the drop-down menu:




Sample code: (This is for reference only)


Sub pageselection

    

    If Page_selection = 0 Then

        Test_page=Page_selection

        ShowPage("Page0")

    End If


    If Page_selection = 1 Then

        Test_page=Page_selection

        ShowPage("Page1")

    End If


    If Page_selection = 2 Then

        Test_page=Page_selection

        ShowPage("Page2")

    End If


End Sub    


5 - Use the NA5 simulator to confirm the functionality: 





Date/Revision History

First review 09/21/2025 V1.0



Author:

Karla Flores Avila, Technical Support Specialist


References


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article