Chapter 3 Summary


[Page 127 (continued)]

  1. The Visual Basic window consists of a form holding a collection of controls for which various properties can be set. Some examples of controls are text boxes, labels, buttons, and list boxes. Some useful properties are Text (sets the text displayed in a control), Name (used to give a meaningful name to a control), Font.Name (selects the name of the font used), Font.Size (sets the size of the characters displayed), Font.Bold (displays boldface text), Font.Italic (displays italic text), BackColor (sets the background color), ForeColor (sets the color of the text), ReadOnly (determines whether text can be typed into the text box), TextAlign (sets the type of alignment for the text in a control), and Visible (shows or hides an object). The With block is a useful device for setting properties at run time.

  2. An event procedure is executed when something happens to a specified object. Some events are object.Click (object is clicked), object.TextChanged (a change occurred in the value of the object's Text property), object.Leave (object loses the focus), and object.Enter (object receives the focus). Note: The statement object.Focus() moves the focus to the specified object.

  3. Two types of literals that can be stored and processed by Visual Basic are numbers and strings.

  4. Many Visual Basic tasks are carried out by methods such as Clear (erases the contents of a text box or list box), Add (places an item into a list box), ToUpper (converts a string to uppercase), ToLower (converts a string to lowercase), Trim (removes leading and trailing spaces from a string), IndexOf (searches for a specified character in a string and gives its position if found), and SubString (returns a sequence of consecutive characters from a string).

  5. The standard arithmetic operations are +,-,*,/, and ^. The only string operation is &, concatenation. An expression is a combination of literals, variables, functions, and operations that can be evaluated.

  6. A variable is a name used to refer to data. Variable names must begin with a letter or an underscore and may contain letters, digits, and underscores. Dim statements explicitly declare variables, specify the data types of the variables, and assign initial values to the variables. In this book, most variables have data types Double, Integer, or String.

  7. Values are assigned to variables by assignment statements. The values appearing in assignment statements can be literals, variables, or expressions. String literals used in assignment statements must be surrounded by quotation marks.

  8. Comment statements are used to explain formulas, state the purposes of variables, and articulate the purposes of various parts of a program.


  9. [Page 128]
  10. Format strings can be used to line up data in tables uniformly and display them with dollar signs, commas, percent signs, and a specified number of decimal places.

  11. A StreamReader object allows us to read data from a file that is specified with an OpenText method. The ReadLine method reads the next unread line from a file.

  12. Functions can be thought of as accepting numbers or strings as input and returning numbers or strings as output.

    Function

    Input

    Output

    CDbl

    string or number

    number

    CInt

    string or number

    number

    CStr

    number

    string

    FormatCurrency

    number

    string

    FormatNumber

    number

    string

    FormatPercent

    number

    string

    InputBox

    string, string

    string

    Int

    number

    number

    Math.Round

    number, number

    number

    Math.Sqrt

    number

    number


  13. Masked text boxes are useful for input since they have a Mask property that specifies the type of data that can be typed into them.




An Introduction to Programming Using Visual Basic 2005
Introduction to Programming Using Visual Basic 2005, An (6th Edition)
ISBN: 0130306541
EAN: 2147483647
Year: 2006
Pages: 164

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net