From the course: Visual Basic Essential Training

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Create a program loop to run an application indefinitely

Create a program loop to run an application indefinitely - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Create a program loop to run an application indefinitely

- [Instructor] We are back in the simple console project. In this example, we're looking at creating an application loop. As we've seen, the application terminates when the code exits the Sub Main. If we want to keep the console interactive for our users, it will be nice to create an application loop. First thing I want to do is comment out the existing code. I don't want to erase this, so I'll highlight it. There's several ways I can comment the code. One is to click here on this button. Now this code won't run. In Visual Basic, this is the comment character, the single quote or the apostrophe. Now, below this, I'm going to write a loop. I will use a do loop, so I'll type in Do and then press enter. Visual Studio subs in the end of the loop. Then I specify condition here at the end. I'll say While True. That means that this is an endless loop. When it goes down to the last line of the loop, it checks this condition. If the condition is true, then it loops around and reprocesses the…

Contents