What is the use of ReDim statement in VBScript?

Questions by RajivPrasad   answers by RajivPrasad

Showing Answers 1 - 4 of 4 Answers

Neha Sahu

  • Apr 17th, 2007

The ReDim statement is used to change the size of the array  within the script:
for example you have declared an array
Dim Customers(50)
But now you want to change the size of the array so you can do that with the help of Redim

ReDim Customers(100)

Neha Sahu

  • Apr 17th, 2007

Redim statement is used to change the size of Array.

  Was this answer useful?  Yes

Amit Dharmale

  • Jul 27th, 2011

ReDim statement is used when we use dynamic array. i.e. to define size of an array dynamically.

If you want to preserve the previously added elements in an array, you can use keyword preserve along with ReDim,

for ex. Dim Array(30)
ReDim Array (50) 'Will redefine array, but already added elements will be lost
ReDim Preserve Array (50) 'Will preserve the previously added elements, also.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions