Chapter 3 Key Terms - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Chapter 3 Key Terms

Description:

TextBox Method highlights the 2 characters starting right after ... nameString = 'Thomas the Tank Engine' block level variable. Declared inside a block of code ... – PowerPoint PPT presentation

Number of Views:84
Avg rating:3.0/5.0
Slides: 21
Provided by: davidlk2
Category:
Tags: chapter | key | terms

less

Transcript and Presenter's Notes

Title: Chapter 3 Key Terms


1
Chapter 3 Key Terms
2
argument
  • Generally, the values we work with or process.
  • The subject of a function or method.
  • Example temperatureTextBox.Select(5,2)
  • TextBox Method highlights the 2 characters
    starting right after character position
    5(characters 6 and 7).

3
assignment operator
  • The equal sign "" is the assignment operator.
  • Most often, assignment statements are used to
    fill variables or a property with a value.
  • Example
  • nameString "Thomas the Tank Engine"

4
block level variable
  • Declared inside a block of code
  • Declared every time the block of code runs.
  • Recognized only within the block in which it is
    declared.
  • Has the smallest scope of all variables.

5
Casting
  • An explicit (deliberate) converstion.
  • Example
  • ageTextBox.Text Convert.ToString(ageInteger)
  • converts the integer value of ageInteger to a
    string which fills the ageTextBox.Text property.
  • Should be tested to be sure no significant digits
    are lost.

6
Named Constant
  • Memory locations of numbers that cannot change at
    run time.
  • Use all caps for a named constant.
  • Use underscore to separate words.
  • PRICE_PER_KWH_Decimal .12D
  • Assignment requires the type declaration
    character (D,R,I,L,S,F)

7
exception
  • A run time error.
  • Statements that might cause an exception should
    be place in the Try / Catch block.

8
format
  • The predetermined way an output number will look
    to the user.
  • Controlled by the format specifier code.
  • Example currency formatted string from a decimal
    type.
  • someTextBox.Text someDecimal.ToString("C")
  • causes the value of someDecimal to be displayed
    with , commas, and two decimal places.
  • See VB Help "format specifier numeric" for more
    ToString argument codes.

9
identifier
  • The name you give to variables and constants.
  • The declared name of any object.

10
implicit converstion
  • No special syntax is used.
  • Allows a widening conversion
  • Example
  • someTextBox.Text numeratorDecimal
  • See VB Help "widening converstions"
  • A narrowing converstion is risky and not allowed
    when Option Strict is On.

11
Intrinsic Constant
  • System defined constants.
  • See Color class
  • See MessageBox class
  • See Math class for pi and e

12
lifetime of a variable
  • The time between events that a variable remains
    declared.
  • A local (block) variable (declared within the
    block) remains declared only during the execution
    of the block.
  • A module-level (form-level) usually remains
    declared as long as the application is running.

13
Message Box
  • For displaying messages (duh).
  • It has but one method Show
  • Bare bones Example
  • MessageBox.Show("Are you sure?")
  • MessageBox is modal. User can do nothing else
    until a button in the box is clicked. That kind
    of demands attention.

14
namespace level variable
  • project wide scope and lifetime
  • programmers prefer to minimize the limits scope
    and lifetime
  • namespace variable will be rare in the programs
    we write in this course.

15
Try and Catch blocks
  • The Try block contains statements susceptible to
    run-time errors (exceptions).
  • The Catch block contains statements for recovery
    from run-time errors (maybe a scolding
    MessageBox, maybe clearing offensive input, maybe
    returning focus).
  • After a Catch, program control automatically
    returns to the Try block.

16
Option Explicit Off
  • Programmer must declare all variables before
    using them.
  • It is unwise to remove Option Explicit because
    you could inadvertently declare a new variable by
    misspelling an existing variable.

17
Option Strict On
  • Prohibits downsize implicit conversions
  • Unwise to allow implicit conversions.
  • Option Strict On should be your first line of
    code.
  • To make Strict and Explicit automatic
  • VB2003 Click ProjectgtPropertiesgtCompile
  • VB2005 Click ToolsgtOptions

18
math order of operations
  • inside the innermost parentheses
  • exponentiation
  • multiply and divide
  • integer division
  • modulus
  • add and subtract
  • work is done from left to right

19
overloading
  • the capacity to use arguments of various
    signatures (number and types of arguments).
  • See MessageBox in Chapter 3 for example.

20
strongly typed
  • Option Strict is ON.
Write a Comment
User Comments (0)
About PowerShow.com