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.
Use the And, Or logical operators - Visual Basic Tutorial
From the course: Visual Basic Essential Training
Use the And, Or logical operators
- [Instructor] For this demonstration, we'll recreate the pizzeria logic challenge from earlier in this chapter with and logical operator and the or logical operator. The scenario is shown here. You get a free pizza at our pizzeria if today is Monday and it's three o'clock. Later we'll do the same logic test but with the or operator. And the way I've implemented this is I have two text boxes on this window. Here you type in the day of the week and here you type in the time and you click on the and button and if this is successful, you get a picture of a pizza and if it's not successful, like this, you get a coupon for a pizza the next time you visit our shop. This is how I've implemented the code. On line eight I have an if statement that says if the text in the text box is equal to Monday, then show the pictures and output this text here at the bottom of the screen. I'm only looking for the word Monday, so if…
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)
-
-
-
-