Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
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-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information