Features
      Ask DevGuru
      ASP Resources
      Find the Bug
      Knowledge Base
      Links
      Tips of the Week
      Tutorials
  Products
      dgCalendar
      dgCharge New!
      dgChart New!
      dgFileUpload
      dgReport New!
      dgSort
      dgTree
  Site
      Authoring
      Coming Soon
      DevGuru Resume
      Link to Us
      Merchandise
      Sponsorships
      Testimonials
      What's New
  Technologies
      ADO 2.6
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      Transact-SQL Syntax
      VBScript
      WML
      WMLScript
      WSH
      XML DOM

              











STATEMENT:  Sub

Sub
 
The Sub statement creates a subroutine, assigns a name, and allows you to list arguments which are to be passed into the subroutine.
 
The major difference between a subroutine and a function, is that a subroutine cannot return any value back to where it was called from.
 
As an option, subroutines can be declared Private or Public. You can call other subroutines and functions from within a subroutine (nesting). You must end every subroutine with End Sub or you will get an error message. One option for leaving a subroutine is to use Exit statements.
 
Code:
<% Sub aardvark %>
   <% Rem you can place all of the code you desire inside a subroutine %>
<% End Sub %>

 
Code:
<% Private Sub aardvark %>
   <% Rem you can place all of the code you desire inside a subroutine %>
<% End Sub %>

 
You can list more than one argument in the subroutine.
 
Code:
<%
Sub aardvark(myvar1, myvar2, mynumber, myarray)
   Rem you can place all of the code you desire inside a subroutine
End Sub
%>


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information