|
22 Visual Basic Scripting Language Reference
This reference was designed to help in the development of your ASP and client side VBScript Language functions. Please remember that you must include adovbs.inc in order to use any “friendly name” of a VBScript constant. A sample adovbs.inc file has been included in Chapter 22, Fundamental ASP Objects
At press time this reference covers VBScript 5.0. For the latest updates to the language please make sure to visit http://msdn.microsoft.com/scripting/vbscript/.
22.1 Constants
This section is a reference to the constants that are available for use with VBScript.
Color Constants
Comparison Constants
Comparison constants are used by certain VB functions.
A binary comparison will compare the strings “Abc” and “abc” as unequal, whereas a text comparison would compare them as the same. In development applications, it is sometimes convenient to use text comparisons for user names or passwords so that the user does not have to remember the case. However, for more secure applications we recommend you use the binary comparison.
Date/Time Constants
Date Format Constants
VServer’s Server Settings are set to (GMT –08:00) Pacific Time (US & Canada); Tijuana.
MsgBox Constants
The MsgBox constants are only useful to client side scripting. The following constants can be used.
The following constants are used with the MsgBox function to identify which button a user has selected.
String Constants
One way to create more efficient code is to use string constants instead of their values. When calling the char function, VBScript must look up the integer value passed and map the result to the appropriate character. When using constants, however, the interpreter only has to perform a table lookup to find the correct character. This results in the code running more efficiently.
If we want our text to have a carriage return for Windows platforms, we would use vbCrLf. When used in ASP applications, this character can make our code output easier to read.
Variable Type Constants
The vbObjectError Constant
An example of the vbObjectError Constant would be:
If myObjectError > vbObjectError then
Err.Raise Number = myObjectError
Else
Err.Raise Number = vbObjectError
End If
22.2 Functions
22.3 Methods
22.4 Objects
22.5 Operators
Operator Precedence
Whenever more than one operation occurs in an expression, each part is evaluated and resolved in a predetermined order. This process is known as operator precedence. Parentheses can be used to override the order of precedence and force some parts of an expression to be evaluated before other parts. Operations within parentheses are always performed before operations outside parentheses. Within parentheses, however, normal operator precedence is maintained.
When expressions contain operators from more than one category, arithmetic operators are evaluated first, comparison operators are evaluated next, and logical operators are evaluated last. Comparison operators have equal precedence. This means that they are evaluated in the left-to-right order in which they appear. Arithmetic and logical operators are evaluated in the following order of precedence:
22.6 Properties
22.7 Control Structures
22.8 Statements
|