Using Visual Basic (Case Statement) You can use the Case statements of the Visual Basic codes to assign numbers to each screen and to create the behavior to switch to the screen that corresponds with the number. 1. Declare on the NJ side a Numerical-type variable to store page numbers. 2. Allocate on the NA side the variable declared in Step 1. Then declare respectively the String-type variable to store page names and the variable to store page numbers on the NA side. “Page_Name”: Variable to indicate page names “Page_No”: Variable to indicate page numbers on the NA side 3. In the global subroutine, write the code as shown on the right. “PageNameSelect”:
switches the NA’s page based on the NJ’s variable value. “PageNumberSelect”: reports to the PLC the number corresponding to the currently displayed page. In either case, to add pages to switch to, increase the conditions of Case. 4. In the [Global Events] tab page, specify the conditions to execute the code created in Step 3 as described below: 1. Indicate the state that the NJ’s page number does not equal to the NA’s page number. 2. Specify the name of the subroutine to execute. 3. Indicate that the action is taken when the page is switched. 4. Specify the name of the subroutine to execute. 1. 2. 3. 4. 5. To switch the page from NJ, modify the “PageNumber” NJ variable.
To switch from NA, modify the “_HMI_CurrentPage” NA system variable. 42