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.

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

right with spaces <strong>and</strong> assigned to var. If var has a user-defined type, then expr must be of<br />

the same type. The statement var = expr is equivalent to Let var = expr.<br />

LINE The graphics method objectName.Line (x1, y1)–(x2, y2) draws a line connecting the<br />

two points. The graphics method objectName.Line –(x2, y2) draws a line from the point<br />

(objectName.CurrentX, objectName.CurrentY) to the specified point. The object object-<br />

Name can be a form, picture box, or the Printer. The line is in color c if objectName.Line (x1,<br />

y1)–(x2, y2), c is executed. The statement objectName.Line (x1, y1)–(x2, y2), ,B draws a rectangle<br />

with the two points as opposite vertices. (If B is replaced by BF, a solid rectangle is<br />

drawn.) After a Line method is executed, the value of objectName.CurrentX becomes x2 <strong>and</strong><br />

the value of objectName.CurrentY becomes y2. [color] [coordinate systems]<br />

LINE INPUT # After a file has been opened as a sequential file for Input with reference<br />

number n, the statement Line Input #n, str assigns to the string variable str the string of characters<br />

from the current location in the file up to the next pair of carriage return/line feed<br />

characters.<br />

LIST The List property of a combo box, directory list box, drive list box, file list box, or list<br />

box is used to access items in the list. When one of these controls is created, <strong>Visual</strong> <strong>Basic</strong><br />

automatically creates the string array List to hold the list of items stored in the control. The<br />

value of List1.List(n) is the item of List1 having index n. The value of List1.List<br />

(List1.ListIndex) is the item (string) currently highlighted in list box List1.<br />

LISTCOUNT For a list or combo box, the value of List1.ListCount or Combo1.ListCount is<br />

the number of items currently in the list. For a directory list box, drive list box, or file list<br />

box, the value of control.ListCount is the number of subdirectories in the current directory,<br />

the number of drives on the computer, or the number of files in the current directory that<br />

match the Pattern property, respectively.<br />

LISTINDEX The ListIndex property gives the index of the currently selected item is a<br />

combo box, directory list box, drive list box, file list box, or list box.<br />

LOAD The Load event applies only to forms <strong>and</strong> usually occurs only once, immediately<br />

when a program starts. This is the appropriate place to put code that should be executed every<br />

time a program is run, regardless of the user’s actions.<br />

LOAD If controlName is the name of a control in a control array whose Index property was<br />

assigned a value during form design <strong>and</strong> num is a whole number that has not yet been used<br />

as an index for the controlName() array, then the statement Load controlName(num) copies<br />

properties of controlName(0) <strong>and</strong> creates the element controlName(num) of the control-<br />

Name() array.<br />

LOADPICTURE The statement objectName.Picture = LoadPicture(pictureFile), where<br />

objectName is a form or picture box, places the picture defined in the file specified by pictureFile<br />

on objectName.<br />

LOC This function gives the current location in a sequential, r<strong>and</strong>om-access, or binary file.<br />

For a sequential file with reference number n, Loc(n) is the number of blocks of 128 characters<br />

read from or written to the file since it was opened. For a r<strong>and</strong>om-access file, Loc(n)<br />

is the current record (either the last record read or written, or the record identified in a Seek<br />

statement). For a binary file, Loc(n) is the number of bytes from the beginning of the file to<br />

the last byte read or written. For communications, the value of Loc(n) is the number of bytes<br />

waiting in the communications buffer with reference number n. [binary file]<br />

LOCK The Lock comm<strong>and</strong> is intended for use in programs that operate on a network. After<br />

a file has been opened with reference number n, the statement Lock #n denies access to the<br />

file by any other process. For a r<strong>and</strong>om-access file, the statement Lock #n, r1 To r2 denies<br />

access to records r1 through r2 by any other process. For a binary file, this statement denies<br />

access to bytes r1 through r2. The statement Lock #n, r1 locks only record (or byte) r1. For<br />

a sequential file, all forms of the Lock statement have the same effect as Lock #n. The

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

Saved successfully!

Ooh no, something went wrong!