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.

446 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

followed on subsequent lines by one or more statements for carrying out the task of the procedure,<br />

<strong>and</strong> ending with the statement End Property. The parameter list parList is a list of<br />

variables through which values will be passed to the procedure when an assignment is made<br />

to the property of an associated object. The name <strong>and</strong> data type of each parameter in a Property<br />

Let procedure must be the same as the corresponding parameter in a Property Get procedure<br />

(if one exists).<br />

PSET The graphics method objectName.PSet(x, y) displays the point with coordinates (x, y)<br />

in the foreground color. The method objectName.PSet(x, y), c causes the point (x, y) to be<br />

displayed in the RGB color specified by c. The size of the point is determined by the value<br />

of the DrawWidth property. The actual color(s) displayed depend on the values of the Draw-<br />

Mode <strong>and</strong> DrawStyle properties. After a PSet method is executed, the value of object-<br />

Name.CurrentX becomes x <strong>and</strong> the value of objectName.CurrentY becomes y. [color]<br />

[coordinate systems]<br />

PUT The Put statement is used to place data into a r<strong>and</strong>om-access file. Suppose recVar is a<br />

variable of a user-defined record type <strong>and</strong> that a file has been opened with a statement of the<br />

form Open fileName For R<strong>and</strong>om As #n Len = Len(recVar). The statement Put #n, r, recVar<br />

places the value of recVar in the rth record of the file.<br />

The Put statement is also used to place data into a file opened as a binary file. Suppose<br />

var is a variable that holds a value consisting of b bytes. (For instance, if var is an integer<br />

variable, then b is 2. If var is an ordinary string variable, then b will equal the length of the<br />

string currently assigned to it.) The statement Put #n, p, var writes the successive bytes of<br />

var into the b consecutive locations beginning with position p in the binary file with reference<br />

number n. (Note: The positions are numbered 1, 2, 3, . . . .) If p is omitted, the current<br />

file position is used as the beginning position. [binary file]<br />

QBCOLOR The function QBColor provides easy access to 16 st<strong>and</strong>ard colors. If colorAttrib<br />

is a whole number from 0 to 15, the value of the functions QBColor (colorAttrib) is the<br />

RGB color number associated with colorAttrib. The following table names the colors produced<br />

by each of the possible values of colorAttrib.<br />

0 Black 4 Red 8 Gray 12 Light Red<br />

1 Blue 5 Magenta 9 Light Blue 13 Light Magenta<br />

2 Green 6 Brown 10 Light Green 14 Yellow<br />

3 Cyan 7 White 11 Light Cyan 15 Intense White<br />

RAISEEVENT After an event has been declared in the general declarations section of a<br />

class module, the statement RaiseEvent EventName(arg1, arg2, . . .) generates the event.<br />

RANDOMIZE The statement R<strong>and</strong>omize automatically uses the computer’s clock to seed<br />

the r<strong>and</strong>om-number generator. If a program includes a R<strong>and</strong>omize statement in the<br />

Form_Load event procedure, the list of numbers generated by Rnd will vary each time the<br />

program is executed. R<strong>and</strong>omize n seeds the generator with a number determined by n. If a<br />

program does not seed the r<strong>and</strong>om-number generator or seeds it with a set number, the list<br />

of numbers generated by Rnd will be the same each time the program is executed.<br />

RECORDCOUNT The value of Data1.Recordset.RecordCount is the number of records in<br />

the database table associated with the data control.<br />

RECORDSOURCE The value of the RecordSource property of a data control is the table of<br />

the database determined by the DatabaseName property. The value can also be an SQL statement<br />

used to specify a virtual table.<br />

REDIM The statement ReDim arrayName(...) erases the array from memory <strong>and</strong> recreates<br />

it. The information inside the parentheses has the same form <strong>and</strong> produces the same results<br />

as that in a Dim statement. After the ReDimensioning, all elements have their default values.<br />

Although the ranges of the subscripts may be changed, the number of dimensions must be

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

Saved successfully!

Ooh no, something went wrong!