VBS TUTORIAL: VBScript statement-private statement _vbs

Source: Internet
Author: User
Tags naming convention

Private statement

Define private variables and allocate storage space. Define a private variable in the Class block.

Private varname[([subscripts])][ varname[([subscripts])]] . . .

Parameters

VarName

The name of the variable, followed by the standard variable naming convention.

subscripts

The number of dimensions of an array variable that can declare up to 60-d arrays. The subscripts parameter uses the following syntax:

Upper [, Upper] ...

The lower bound of an array is always 0.

Description

A Private statement variable can only be used in a script that declares the variable.

Before you use a variable that references an object, you must assign an existing object to the variable with the Set statement. The declared object variable is initialized empty before the assignment.

You can also declare a dynamic array with a Private statement with empty parentheses. After declaring a dynamic array, you can define the dimensions and elements of the array using the ReDim statement within the procedure. An error occurs if the array size is explicitly specified in Private, public, or Dim statements, but an attempt is made to declare the array dimension again.

Note When you use a private statement in a procedure, you usually place the private statement at the beginning of the procedure.

The following examples illustrate how to use Private statements:

Private MyNumber   ' Private Variant variable.Private MyArray(9)   ' Private array variable.   ' Multiple Private declarations of Variant variables.Private MyNumber, MyVar, YourNumber

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.