11 Apr

VB Script:
VBScript is a subset of Visual Basic 4.0 language which is developed by Microsoft. VBScript provides more processing power to Web pages. Writing of both server side and client side scripting can be done by VBScript.
Variables:
It supports only one data type which is known as Variant and this variant comes under a special category of data types which consists of many types of data. Well Variant is the default type returned by all functions in VBScript.
And Variables the location which stores the information of program which may change at the run time.
Some of the sub data types in Variant are
1.Empty
2. Null
3. Boolean
4. Byte
5. Integer
6. Currency
7. Long
8. Single
9. Double
10. Date (Time)
11. String
12. Object
13. Error
Conversion functions are used to covert data from one sub data type to another type.
Creating a variable:
Variables are used to store information. Observe how a variable is created and a value assigned to it.
<html>
<body>
<script type= “text/vbscript”>
dim name
name= “Garuda Trainings”
document.write(name)
</script>
</body>
</html>
How Variable declaration is done in VBScript?
1.Dim Statement
2.Public Statement
3.Private Statement

Eg:   Dim x
X = 100  Normal declaration

Eg: Optional Explicit
Dim x
X = 100  When optional explicit is included
Optional Explicit statement should be in the first statement in the script. This Option Explicit is used when you declare a variable implicitly by using the name in a simple manner in your script and this may result in unexpected results.
Three important points to remember in VBScripts:
Optional Explicit statement should be the first statement in the script.
Public statement variable are available to all procedures in all scripts.
Private statement variables only to the script in which they are declared.
Converting a variable into array:
Eg :   Dim x
X = array(“what”,“is”,“that”)
for i=lbound(x) to ubound(x)
msgbox v(i)
Next
Here ‘x’ is a dynamic array.

Constants:
Constant is a word which means fixed. It occupies the place of a number, symbol,  or a string and never changes. Some of the intrinsic constants in VBScript are vbOK, vbCancel, vbTrue, vbFalse etc .
Creating constants:
const str = “Performance”
In the above statement str is a constant and hence its value does not change. Constants are of two types which are Public and Private but by default all constants are Public.