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
All Statements
Dim Statement
Private Statement
ReDim Statement
Set Statement
STATEMENT: Public
Implemented in version 1.0
Public
The
Public
statement is used to declare a new public variable or array. You can declare more than one variable and/or array at a time. Memory is also allocated. You cannot declare a variable and assign a value to it at the same time.
The purpose of
Public
has changed with the addition of
Class
to VBScript. The recommendation is to only use
Public
inside a
Class
. A variable declared using
Public
in a
Class
becomes a public property of that
Class
. That means that other code contained in the same
Class
can access the variable.
If declared within a script, the results are the same as using
Dim
or
Private
, the public variable or array is available for use in the entire script.
Code:
<%
Public YourNumber
%>
<%
' First declare
Public YourNumber
' Then assign a value
YourNumber = 1895.405
%>
<%
Public SomeNumber, MyVar, AnotherString
%>
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information