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.

APPENDIX C<br />

VISUAL BASIC STATEMENTS, FUNCTIONS, METHODS,<br />

PROPERTIES, EVENTS, DATA TYPES, AND OPERATORS<br />

This appendix applies to the following objects: form, printer, text box, comm<strong>and</strong> button,<br />

label, <strong>and</strong> picture box. The last four are also called controls. Terms in brackets follow<br />

some of the discussions. These terms refer to supporting topics presented at the end of this<br />

appendix.<br />

ABS The function Abs strips the minus signs from negative numbers while leaving other<br />

numbers unchanged. If x is any number, then the value of Abs(x) is the absolute value of x.<br />

ACTION The type of a common dialog box can be determined by the setting of the Action<br />

property (1-Open, 2-Save As, 3-Color, 4-Font, 5-Print). This use is obsolete. Instead, use the<br />

methods ShowOpen, ShowSave, ShowColor, ShowFont, <strong>and</strong> ShowPrinter. For an OLE control,<br />

the setting of the Action property during run time determines the action to take.<br />

ADD A statement of the form collectionName.Add objectName adds the named object to a<br />

collection. A statement of the form collectionName.Add objectName keyString adds the named<br />

object to a collection with the key keyString.<br />

ADDITEM The AddItem method adds an additional item to a list box or combo box <strong>and</strong> adds<br />

an additional row to a grid. A statement of the form List1.AddItem str inserts the string either<br />

at the end of the list (if Sorted = False) or in its proper alphabetical position (if Sorted = True).<br />

The statement List1.AddItem str, n inserts the item at the position with index n. The use of an<br />

index is not recommended when Sorted = True. The statement MSFlexGrid1.AddItem “”, n<br />

inserts a new row into the grid at position n.<br />

ADDNEW The AddNew method is used with a data control to set the stage for the addition<br />

of a new record to the end of a file. It clears any controls bound to the data control. The actual<br />

addition takes place after Value <strong>and</strong> Update statements are executed.<br />

ALIGNMENT The Alignment property of a text box or label affects how the text assigned to<br />

the Text property is displayed. If the Alignment property is set to 0 (the default), text is displayed<br />

left-justified; if set to 1, text is right-justified; <strong>and</strong> if set to 2, text is centered.<br />

AND (Logical Operator) The logical expression condition1 And condition2 is true only if<br />

both condition1 <strong>and</strong> condition2 are true. For example, (3”a”) is true because<br />

3”a”. Also, (“apple”>”ape”) And (“earth”>”moon”) is false because<br />

“earth”>”moon”is false.<br />

AND (Bitwise Operator) The expression byte1 And byte2 is evaluated by expressing each<br />

byte as an 8-tuple binary number <strong>and</strong> then Anding together corresponding digits, where 1 And<br />

1 equals 1, 1 And 0, 0 And 1, <strong>and</strong> 0 And 0 all equal 0. For example, the expression 37 And 157<br />

translated to binary 8-tuples becomes 00100101 And 10011101. Anding together corresponding<br />

digits gives the binary 8-tuple 00000101 or decimal 5. Thus, 37 And 157 is 5.<br />

ARRAY If arglist is a comma-delimited list of values, then the value of the function Array(arglist)<br />

is a variant containing an array of these values. See Dim for discussion of arrays.<br />

ASC Characters are stored as numbers from 0 to 255. If str is a string of characters, then<br />

Asc(str) is the number corresponding to the first character of str. For any n from 0 to 255,<br />

Asc(Chr(n)) is n.<br />

ATN The trigonometric function Atn, or arctangent, is the inverse of the tangent function.<br />

For any number x, Atn(x) is an angle in radians between –pi/2 <strong>and</strong> pi/2 whose tangent is x.<br />

[radians]<br />

Appendix C 423

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

Saved successfully!

Ooh no, something went wrong!