COS120-Ch4.1-4.2 - COS120 Chapter 4.1-4.2 All programming...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
COS120 Chapter 4.1-4.2 All programming languages provide one or more selection statements. A condition or conditions are evaluated to True or False and one of a group of statements is executed. VB provides the following selection statements: If-Then If-Then-Else If-Then-Else-ElseIf-Then… Select Case The If-Then statement is used when a single condition is tested. If the condition is True , do the group of statements. If the condition is False , do nothing. Dim hours As Integer ‘ hours worked in a week Dim overtime As Double ‘ amount of overtime pay at $15.75 per hour hours = CInt (txtHours.Text) If hours > 40 Then overtime = (hours – 40) * 15.75 lblOvertime.Text = FormatCurrency(overtime) End If Notes: 1. A condition is built up from the six relational operators. = Equal To <> Not Equal To < Less Than <= Less Than or Equal To > Greater Than >= Greater Than or Equal To 2. VB is a line-driven language and is expecting parts of the statement is correct order on separate lines. 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Using If Statements to Determine User’s Input Choices: So far, we have used only the text box control to solicit user input. VB offers a variety of other controls, such as check boxes and radio buttons. For better accuracy, limit user typing!
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/06/2008 for the course COS 120 taught by Professor Carolroberts during the Spring '08 term at University of Maine Orono .

Page1 / 5

COS120-Ch4.1-4.2 - COS120 Chapter 4.1-4.2 All programming...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online