Amazon.com: PC Books || Educational Software || Magazines
Amazon: Books-CA || Software-CA || Books-UK || Software-UK

HTML | Javascript | ASP | PHP | VBScript | SQL | Hardware | PC FAQ| WinXP|

Learn to Build, Upgrade, or Repair your Computer Ebook + PC Safety 101 kwwebservice.com Reasonably priced web development & hosting
VBS Basics
Introduction
Variables & Arrays
Sub & Function Procedure
If Statements
Case Statements
Loop Statements
Operators
Forms
MsgBox Function
Books @
CA Amazon
UK Amazon
US Amazon
 

VB Script Sub Procedure

Sub procedure is collection of vb script statements that performs a task and executes when it's called on event procedure. Event procedure is any clickable objects or on load event. Sub procedure does not return a value like function does.
Here is a syntax for sub procedure:
Sub calc()
 your vb script code here
End Sub

The following example is sub procedure that gets users first name and last name then displays users full name on message box. The sub is executed when button is clicked.
<html>
<head>
<script language="vbscript">
sub GetUserName()
 dim firstName
 dim lastName
  firstName=inputbox("Please type your first name")
 lastName=inputbox("Please type your last name")
 msgbox("Your full name is: "&firstName&" "&lastName)
end sub
</script>
</head>
<body>
<form>
 <input type="button" value="Click" onclick="call GetUserName()">
</form>
</body>
</html>
We saw the variables and input box before. Msgbox display message window and writes on anything whithin the brackets. Onclick() is an event executed when the button is clicked and in this case it calls GetUserName sub procedure. When GetUserName is called, all the statements in it is evaluated and executed.
Variables & Arrays Function Procedures

Bluehost.com Web Hosting $6.95
PC System Tools
SpyCleaner
Registry Mechanic
4Diskclean Pro
Health PC Club
TweakNow
Registry Washer
SpyAnyWhere
System Lifeguard
...More/Details

PC Articles
  Computer Safety
prevent viruses & Spyware