Chapter 5


Home

Chapter 1

Chapter 2

Chapter 3

Chapter 4

Chapter 5

Chapter 6

Chapter 7

Chapter 8

Chapter 9

Chapter 10

Chapter 11

Chapter 12

Chapter 13

Chapter 14

Chapter 15

Table of Contents


Strings and Table Construction

Strings are series of characters. The empty string is shown as ""; this represents a string with no characters. Strings can be compared using the following operators: =, <, >, and <>. When you use the less than and greater than operators, the program compares the strings by comparing the ASCII codes of the characters. "A" is less than "Z", but it is also less than "a." Concatenation is the joining together of strings. The concatenation operator is the ampersand.

The UCase$(str) and LCase$(str) functions convert a string to all uppercase or all lowercase characters. Characters that do not represent letters are not affected.

The StrComp(a$, b$, 1) function compares the two strings a$ and b$ and returns:

    a) -1 if a$ is less than b$
    b) 0 if the strings are equal
    c) 1 if a$ is greater than b$

The Len(str) function takes a string as a parameter and returns a whole number representing the number of characters in the string.

The Format$(n,format string) function determines the appearance of values displayed. It displays values with a particular number of decimal places, or a percentage sign or commas are included in the display.

Format$(x, "Fixed") displays the value of x with at least one digit to the left of the decimal point and two digits to the right.

Loops peform sections of code repeatedly, using a different value of some variable on each repetition. Loops can be nested inside one another.

A scrollbar can be used for output only, to display the value of a variable within the program; or it can be used to let the user input values to the program by moving the graphic scroll box. The Value property provides the connection between a numeric value and the position of the scroll box. The Min and Max properties control the minimum and maximum value the scrollbar can assume.

The SmallChange and LargeChange properties of the scrollbar control what happens when a mouse is clicked on various parts of the scrollbar.

The dimensions of a textbox are determined by the settings in the Height and Width properties of the box. The dimensions of a form are determined by its ScaleHeight and ScaleWidth properties.

When the dimensions of a form are changed, a Resize event occurs.

The syntax of the InputBox function is:

    variable name = InputBox (prompt string, box title string, default value)