ch03 - Microsoft Visual Basic 2008: Reloaded Third Edition...

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

View Full Document Right Arrow Icon
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter Three Variables, Constants, and Arithmetic Operators
Background image of page 1

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

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 2 Objectives After studying this chapter, you should be able to: Declare variables and named constants Assign data to an existing variable Convert data to the appropriate type using the TryParse method and the Convert class methods Write arithmetic expressions Understand the scope and lifetime of variables and named constants
Background image of page 2
Microsoft Visual Basic 2008: Reloaded, Third Edition 3 Objectives (continued) Understand the purpose of the Option statements Use a TOE chart, pseudocode, and a flowchart to code an application Clear the contents of a control’s Text property while an application is running Send the focus to a control while the application is running Explain the difference between syntax errors and logic errors Format an application’s numeric output
Background image of page 3

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

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 4 Variables Variables : computer memory locations used to store data while an application is running Use a meaningful variable name that reflects the purpose of the variable Use camel casing for variable identifiers Variable names should conform to naming rules
Background image of page 4
Variables (continued) Microsoft Visual Basic 2008: Reloaded, Third Edition 5 Figure 3-1: How to name a variable
Background image of page 5

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

View Full DocumentRight Arrow Icon
Variables (continued) Each variable must be assigned a data type Data type : the type of data the variable can store Each data type is a class Unicode : Universal coding scheme for characters Assigns a unique numeric value to each character Microsoft Visual Basic 2008: Reloaded, Third Edition 6
Background image of page 6
Microsoft Visual Basic 2008: Reloaded, Third Edition 7 Figure 3-2: Basic data types in Visual Basic
Background image of page 7

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

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 8 Declaring a Variable in Code Declaration statement : used to declare, or create, a variable Declaration statement includes Scope keyword: Dim , Private , or Static Name of the variable Data type Initial value (optional) Numeric data types are automatically initialized to 0 String data type is automatically initialized to “”
Background image of page 8
Microsoft Visual Basic 2008: Reloaded, Third Edition 9 Figure 3-3: How to declare a variable
Background image of page 9

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

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 10 Assigning Data to an Existing Variable Assignment statement : Used to assign values to properties of controls Used to assign values to variables Assignment operator : (=) Value on the right of the = operator is assigned to the variable on the left of the = operator
Background image of page 10
Assigning Data to an Existing Variable (continued) String : group of characters enclosed in quotation marks Literal constant : An item of data whose value does not change while the application is running Can be a numeric or a string literal constant A numeric literal without a decimal place is treated
Background image of page 11

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

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 63

ch03 - Microsoft Visual Basic 2008: Reloaded Third Edition...

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

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