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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SECOND The function Second extracts the seconds from a serial date. If d is any valid serial<br />

date, the value of Second(d) is a whole number from 0 to 59 giving the seconds recorded<br />

as part of the date <strong>and</strong> time stored in d. [date]<br />

SEEK The statement Seek #n, p sets the current file position in the binary or r<strong>and</strong>om-access<br />

file referenced by n to the pth byte or record of the file, respectively. After the statement is<br />

executed, the next Get or Put statement will read or write bytes, respectively, beginning with<br />

the pth byte or record. The value of the function Seek(n) is the current file position either in<br />

bytes or by record number. After a Put or Get statement is executed, the value of Seek(n) is<br />

the number of the next byte or record. [binary file]<br />

SELECT CASE The Select Case statement provides a compact method of selecting for execution<br />

one of several blocks of statements based on the value of an expression. The Select<br />

Case block begins with a line of the form Select Case expression <strong>and</strong> ends with the statement<br />

End Select. In between are clauses of the form Case valueList <strong>and</strong> perhaps the clause Case<br />

Else. The items in the valueList may be individual values or ranges of values such as “a To<br />

b”or “Is < a”. Each of these Case statements is followed by a block of zero or more statements.<br />

The block of statements following the first Case valueList statement for which valueList<br />

includes the value of expression is the only block of statements executed. If none of<br />

the value lists includes the value of expression <strong>and</strong> a Case Else statement is present, then the<br />

block of statements following the Case Else statement is executed.<br />

SENDKEYS The statement SendKeys str places in the keyboard buffer the characters <strong>and</strong><br />

keystrokes specified by str. The effect is exactly the same as if the user had typed the series<br />

of characters/keystrokes at the keyboard. The statement SendKeys str, True places keystrokes<br />

in the keyboard buffer <strong>and</strong> waits until these keystrokes are processed (used) before allowing<br />

program execution to continue with the next statement in the procedure containing the Send-<br />

Keys statement. Keystrokes can be specified that do not have a displayable character or that<br />

result from using the Shift, Ctrl, or Alt keys.<br />

SET Essentially, Set is “Let for objects.” Whereas the Let statement is used to assign ordinary<br />

values to variables or properties, the Set statement is used to assign objects to variables<br />

or properties.<br />

The statement Set controlVar = objectExpression associates the name controlVar with<br />

the object identified by objectExpression. For example, if the statements Dim Scenery As<br />

PictureBox <strong>and</strong> Set Scenery = Picture1 are executed, then Scenery becomes another name for<br />

Picture1, <strong>and</strong> references like Scenery.Print message are equivalent to Picture1.Print message.<br />

Also, the Set statement assigns an object to an object variable. When you want to release the<br />

memory used for the object, execute Set objVar = Nothing.<br />

SETATTR The statement SetAttr fileName, attribute sets the file attribute of the file specified<br />

by fileName. A file’s attribute can be 0 for “Normal”or a combination of 1, 2, or 4 for<br />

“Read-only”, “Hidden”, <strong>and</strong> “System.” In addition, a file can be marked as “changed since<br />

last backup”by adding 32 to its attribute. Thus, for example, if a file’s attribute is set to 35<br />

(1 + 2 + 32), the file is classified as a Read-only Hidden file that has been changed since the<br />

last backup.<br />

SETFOCUS The method objectName.SetFocus moves the focus to the named form or control.<br />

Only the object with the focus can receive user input from the keyboard or the mouse.<br />

If objectName is a form, the form’s default control, if any, receives the focus. Disabled <strong>and</strong><br />

invisible objects cannot receive the focus. If an attempt is made to set focus to a control that<br />

cannot receive the focus, the next control in tab order receives the focus.<br />

SETTEXT The method ClipBoard.SetText info replaces the contents of the clipboard with<br />

the string info.<br />

SGN The value of the function Sgn(x) is 1, 0, or –1, depending on whether x is positive,<br />

zero, or negative, respectively.<br />

Appendix C 449

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

Saved successfully!

Ooh no, something went wrong!