1 / 6

VB Conditionals

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 making. The code below demonstrates the most commonly used If…Then patterns in VB.

shae
Download Presentation

VB Conditionals

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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.

  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 • 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)

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

More Related