ÄúµÄλÖãºÑ°ÃÎÍøÊ×Ò³£¾±à³ÌÀÖÔ°£¾VBScript£¾VBScript


objects constants operators statements functions properties methods






STATEMENT:  ReDim

ReDim

The ReDim statement allows you to redeclare the size of a dynamic array and to reallocate the storage space (memory).

If you make the array bigger, you can use the keyword Preserve to protect all of the existing elements. If you make the array smaller, you will lose part of the array elements even if you use Preserve.

In the last line of the code example, note that only the first 9 elements are saved, you lose the other 990 elements.

Code:
<% Dim myarray() %>
<% ReDim myarray(5) %>
<% ReDim Preserve myarray(999) %>
<% ReDim Preserve myarray(9) %>