Following is the example of using GoTo with Select-Case statement to transfer the control from one Select-Case label to another based on our requirements. ![]() Now, we will see how to use GoTo statement in the Select-Case statement with an example. Hotkey support for VB IDE: Alt+Y insert empty Try-Catch block Alt+N insert empty Resume-Next block Alt+G insert Debugger template for runtime errors VBScript example: ' programmed by. In visual basic, we can use the GoTo statement to exit from the defined loops or transfer the control to the specific Select-Case label or the default label in the Select statement based on our requirements. Visual Basic Goto Statement with Select Statement ![]() If you observe the above result, whenever the variable ( i) value equals 5, the GoTo statement transfers the program control from for loop to the specified label statement ( endloop) position. We will get the following result when we execute the above visual basic program. ![]() ![]() If you observe above example, we used GoTo statement in for loop with labeled statement “ endloop” to exit for loop and transfer the program execution to the defined label statement whenever the variable ( i) value equals 5. This paper is to help with this transition from teaching programming courses using VB6 to the same ones teaching VB. Console.WriteLine("Press Enter Key to Exit.")
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |