18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong> <strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong><br />

ReDim<br />

Description Declare dynamic array variables, and allocates or reallocates storage space at the procedural<br />

level<br />

Usage ReDim [Preserve] varname(subscripts) [, varname(subscripts)]<br />

Arguments Preserve<br />

Optional. Preserves the data in an existing array when you change the size of the single<br />

dimension or the last dimension (only). If an array is contracted, data in the last elements will<br />

still be lost. There is a high overhead associated with using the Preserve functionality and<br />

should only be used when necessary.<br />

varname<br />

Required, Name of the array variable, following standard variable naming conventions. Can<br />

be any Variant subtype.<br />

Subscripts<br />

Dimensions of an array variable, up to 60 multiple dimensions may be declared. The<br />

subscripts argument uses the following syntax: Upper[,upper]… The lower bound of an array<br />

is always zero in <strong>VBScript</strong> since arrays are zero-based.<br />

Returns Returns a Variant containing an Array<br />

Remarks The ReDim statement is used to size or resize a dynamic array that has already been <strong>for</strong>mally<br />

declared using a Private, Public, or Dim statement with empty parentheses (without dimension<br />

subscripts). You can use the ReDim statement repeatedly to change the number of elements and<br />

dimensions in an array. If you use the Preserve keyword, you can resize only the last array<br />

dimension, and you can't change the number of dimensions at all. For example, if your array has<br />

only one dimension, you can resize that dimension because it is the last and only dimension.<br />

However, if your array has two or more dimensions, you can change the size of only the last<br />

dimension and still preserve the contents of the array. Note that if you make an array smaller than<br />

it was originally, data in the eliminated elements is lost.<br />

A dynamic array must be declared without dimension subscripts.<br />

See also Dim, Set<br />

Example(s) Dim X() ‘ Declare a dynamic array<br />

ReDim X(10,10,10) ‘ Declares dynamic array variables<br />

ReDim Preserve X(10,10,15) ‘ Change the size of the last dimension, preserving data<br />

Rem (or) ‘<br />

Description Includes explanatory remarks in a program<br />

Usage Rem comment<br />

or<br />

‘ comment<br />

Arguments comment<br />

The comment argument is the text of any comment you want to include. After the Rem<br />

keyword, a space is required be<strong>for</strong>e comment.<br />

Returns N/A<br />

Remarks You can use an apostrophe (') instead of the Rem keyword. If the Rem keyword follows other<br />

statements on a line, it must be separated from the statements by a colon. However, when you<br />

use an apostrophe, the colon is not required after other statements.<br />

Example myStr1 = “control” : Rem This is a comment after a statement, separated by a colon<br />

myStr2 = “valve” ‘ This is also a comment but here, no colon is needed<br />

Rem This is a comment line. No colon is needed<br />

190 <strong>InduSoft</strong>, Ltd.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!