19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

SUMMARY<br />

1. The <strong>Visual</strong> <strong>Basic</strong> screen consists of a collection of objects for which various<br />

properties can be set. Some examples of objects are text boxes, labels, comm<strong>and</strong><br />

buttons, picture boxes, <strong>and</strong> the form itself. Objects placed on the form are<br />

called controls. Some useful properties are Text (set the text displayed by a text<br />

box), Caption (set the title of a form, the contents of a label, or the words on a<br />

comm<strong>and</strong> button), Font.Size (set the size of the characters displayed), Alignment<br />

(set the placement of the contents of a label), MultiLine (text box to display<br />

text on several lines), Picture (display drawing in picture box), ForeColor<br />

(set foreground color), BackColor (set background color), Visible (show or hide<br />

object), BorderStyle (alter <strong>and</strong> possibly remove border), Font.Bold (display<br />

boldface text), <strong>and</strong> Font.Italic (display italic text).<br />

2. An event procedure is called when a specific event occurs to a specified object.<br />

Some event procedures are object_Click (object is clicked), object_LostFocus<br />

(object loses the focus), object_GotFocus (object receives the focus), <strong>and</strong><br />

object_KeyPress (a key is pressed while object has the focus).<br />

3. <strong>Visual</strong> <strong>Basic</strong> methods such as Print <strong>and</strong> Cls are applied to objects <strong>and</strong> are coded<br />

as object.Print <strong>and</strong> object.Cls.<br />

4. Two types of constants that can be stored <strong>and</strong> processed by computers are numbers<br />

<strong>and</strong> strings.<br />

5. The arithmetic operations are +, –, *, /, <strong>and</strong> ^. The only string operation is &,<br />

concatenation. An expression is a combination of constants, variables, functions,<br />

<strong>and</strong> operations that can be evaluated.<br />

6. A variable is a name used to refer to data. Variable names can be up to 255 characters<br />

long, must begin with a letter, <strong>and</strong> may contain letters, digits, <strong>and</strong> underscores.<br />

Dim statements explicitly declare variables <strong>and</strong> specify the types of the<br />

variables. In this book, variables have types Single, Integer, <strong>and</strong> String.<br />

7. Values are assigned to variables by assignment <strong>and</strong> Input # statements. The values<br />

appearing in assignment statements can be constants, variables, or expressions.<br />

Input # statements look to data files for constants. String constants used<br />

in assignment statements must be surrounded by quotation marks, whereas quotation<br />

marks are optional for string constants input with Input #. InputBox can<br />

be used to request that the user type in data.<br />

8. The Print method displays information in a picture box or on the printer. Semicolons,<br />

commas, <strong>and</strong> Tab control the placement of the items on a particular line.<br />

A temporary message can be displayed on the screen using the MsgBox statement.<br />

9. You control the printer with the Printer object <strong>and</strong> write to it with statements of<br />

the form Printer.Print expression. You set properties with statements of the form<br />

Printer.property = setting. Printer.NewPage starts a new page <strong>and</strong> PrintForm<br />

does a screen dump. A series of comm<strong>and</strong>s to the Printer object must end with<br />

EndDoc, which actually produces the final printed page.<br />

10. Comment statements are used to explain formulas, state the purposes of variables,<br />

<strong>and</strong> articulate the purposes of various parts of a program.<br />

11. The Format functions provide detailed control of how numbers, dates, <strong>and</strong><br />

strings are displayed. Numbers can be made to line up uniformly <strong>and</strong> be displayed<br />

with dollar signs, commas, <strong>and</strong> a specified number of decimal places.<br />

Dates can be converted to a long form. Strings can be right-justified.<br />

<strong>Programming</strong> Projects 67

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!