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.
Exit or continue loops - Visual Basic Tutorial
From the course: Visual Basic Essential Training
Exit or continue loops
- [Instructor] There are two special keywords we can use to change the normal loop process. We can exit the loop early or we can skip one iteration of the loop, that is the exit keyword and the continue keyword. The way this demo's going to work is we're going to look through this value, this string value here, and I'm looking for a character. And when I find the character, I'm going to take one of these actions, exit or continue. This is what the code looks like. Here is how you use exit. I'm in a for loop, so I would say exit for. If I was in a do loop, then I would type in exit do. If I want to continue, then I change exit to continue. What I'm doing is I'm grabbing the string from the UI. I'm setting up a char, and then this bit of code is going to look through the string. Now there are better ways to do this. I'm only using this as an example of how to work with the for loop. The string class itself has better ways of doing what I'm showing you here. I want to point on something…
Download courses and learn on the go
Watch courses on your mobile device without an internet connection. Download courses using your iOS or Android LinkedIn Learning app.
Contents
-
-
Chapter roadmap4m 33s
-
(Locked)
Set up the tools1m 45s
-
(Locked)
Create a console app1m 46s
-
(Locked)
What files are in the new project2m 23s
-
(Locked)
Build and compile the application2m 10s
-
(Locked)
Run the application4m 49s
-
(Locked)
Work with the console class2m 1s
-
(Locked)
The forgiving nature of VB code2m 2s
-
-
-
(Locked)
Optimize the Visual Studio settings1m 55s
-
(Locked)
Create a console project in Visual Studio4m 2s
-
(Locked)
Projects and solutions2m 5s
-
(Locked)
Examine the template structure and code1m 45s
-
(Locked)
How the editor enhances our code3m
-
Use the auto suggestions when editing5m 21s
-
(Locked)
Compile the project code2m 9s
-
(Locked)
Run the example code from Visual Studio2m 28s
-
(Locked)
Run the example code with a debugger2m 23s
-
(Locked)
-
-
(Locked)
Understand default code flow for an application6m 49s
-
(Locked)
Event driven code3m 21s
-
(Locked)
Create a program loop to run an application indefinitely4m 52s
-
(Locked)
Listen for KeyChar to terminate the loop3m 9s
-
(Locked)
The To-Do application1m 18s
-
Work with a Windows UI project4m 49s
-
(Locked)
Add click event handler code3m 29s
-
(Locked)
Add TextChanged event handler code2m 30s
-
(Locked)
-
-
(Locked)
Work with variables and constants8m 17s
-
(Locked)
Use the code explorer project3m 26s
-
(Locked)
Declare a variable5m 35s
-
(Locked)
Variables and .NET types3m 36s
-
(Locked)
Naming your variables2m 19s
-
(Locked)
Understand the variable scope: What code can access the variable4m 19s
-
How data conversion works7m 49s
-
(Locked)
Convert numeric values5m 35s
-
(Locked)
Create custom constants1m 29s
-
(Locked)
Work with built-in constants3m 36s
-
(Locked)
Work with enum values3m 45s
-
(Locked)
Create a custom enum1m 35s
-
(Locked)
-
-
(Locked)
Understanding strings6m 41s
-
(Locked)
Create string variables4m
-
(Locked)
Concatenation and interpolation2m 56s
-
(Locked)
Search string contents2m 59s
-
(Locked)
Modify string contents3m 3s
-
(Locked)
String creation with StringBuilder5m 39s
-
(Locked)
Compare and equals5m 51s
-
(Locked)
Convert and format numbers to strings8m 4s
-
(Locked)
Implicit covert strings to numbers2m 50s
-
(Locked)
Use Parse and TryParse conversions5m 4s
-
(Locked)
-
-
(Locked)
The date types2m 27s
-
(Locked)
Define date and time variables1m 6s
-
(Locked)
Initialize date and time values4m 42s
-
(Locked)
Output formatted date values3m 50s
-
(Locked)
Date manipulation2m 14s
-
(Locked)
Challenge: Strings, dates, and parsing1m 47s
-
(Locked)
Solution: Strings, dates, and parsing2m 22s
-
(Locked)
-
-
(Locked)
The Code Explorer updated UI58s
-
(Locked)
If and else statements5m 44s
-
(Locked)
Use the AndAlso and OrElse logical operators4m 12s
-
(Locked)
Select case: A better way to branch5m 1s
-
(Locked)
Challenge: Logic statements and string compare2m 5s
-
(Locked)
Solution: Logic statements and string compare2m 51s
-
(Locked)
-
-
(Locked)
Explore the collection classes10m 18s
-
(Locked)
Use a ListBox instead of a text control3m 10s
-
(Locked)
Create new collections6m 30s
-
(Locked)
Initialize a collection2m 23s
-
(Locked)
Add items to a list1m 13s
-
(Locked)
Get items from the list3m 16s
-
(Locked)
Remove items from a list1m 15s
-
(Locked)
Iterate over a list5m 20s
-
(Locked)
Bind a list to a user control5m 46s
-
(Locked)
Delegates and lambda expressions4m 36s
-
(Locked)
Customize a method with predicate functions5m 21s
-
(Locked)
Quick look at other collection classes4m 28s
-
(Locked)