From the course: Visual Basic Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Select Case - Visual Basic Tutorial
From the course: Visual Basic Essential Training
Select Case
- [Instructor] The Select Case statement provides an alternative to a series of if and else/if statements. It's similar to the Switch statement in languages like Java and PHP. To add one to your code, type in the word 'select', then press the Tab key twice. Visual studio adds a snippet to your application and it puts placeholders in the snippet. They're the yellow items. And I can use the Tab key to move between the placeholders. This allows me to quickly change the value in the snippet, then move to the next place and so on. I don't need this so I'll press the Esc key, and then we'll talk about what's happening on line nine. That's the fist line in the Select Case statement that says evaluate the current value of variable name and then compare it against all the case statements written below this. I've got two case statements; Case One and Case Two. And then I have Case Else. So if variable is one, It'll run the…
Contents
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Explore the arithmetic operators3m 24s
-
(Locked)
Explore the comparison and logical operators5m 56s
-
(Locked)
If and Else5m 16s
-
(Locked)
Use the And, Or logical operators3m 13s
-
(Locked)
Use AndAlso, OrElse for better performance2m 48s
-
(Locked)
Select Case3m 30s
-
(Locked)
Challenge: Logic statements and string compare1m 50s
-
(Locked)
Solution: Logic statements and string compare3m 16s
-
(Locked)
-
-
-
-