Presentation is loading. Please wait.

Presentation is loading. Please wait.

VB Conditionals If Then, Select Case. If Then Useful computer programs typically have to make a lot of decisions. In VB, If…Then code is used for decision.

Similar presentations


Presentation on theme: "VB Conditionals If Then, Select Case. If Then Useful computer programs typically have to make a lot of decisions. In VB, If…Then code is used for decision."— Presentation transcript:

1 VB Conditionals If Then, Select Case

2 If Then Useful computer programs typically have to make a lot of decisions. In VB, If…Then code is used for decision making. The code below demonstrates the most commonly used If…Then patterns in VB. The full code for these examples can be found in Conditionals.zip, available in Lecture materials. 2

3 If Then…Else If Generally, I prefer either Select Case or a series of If Thens to using Else If; however The code below seems to be the best way to determine which radio button is selected:

4 Select Case 4 When you want to choose among several options based on the value of an expression, you can use Select Case. The full code for these examples can be found in Conditionals.zip, available in Lecture materials.

5 Select Case Here’s another Select Case example. Note that it uses the colon (“:”) to combine two lines of code into one. This example is demonstrated in the video (see slide 29) 5

6 Another Select Case Example This example demonstrates several different Case formats that can be used: 6


Download ppt "VB Conditionals If Then, Select Case. If Then Useful computer programs typically have to make a lot of decisions. In VB, If…Then code is used for decision."

Similar presentations


Ads by Google