Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The usage of ReDim statement in VBS

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "the usage of ReDim sentence in VBS". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the usage of ReDim sentence in VBS.

Declare dynamic array variables at the procedure level and allocate or reallocate storage space.

ReDim [Preserve] varname (subscripts) [, varname (subscripts)]. . .

Parameter Preserve

Preserves data when changing the size of the last dimension of an existing array.

Varname

Variable name, following the standard variable naming convention.

Subscripts

The dimension of array variables, up to 60-dimensional arrays can be declared. The syntax format of the subscripts parameter is as follows:

Upper [, upper]. . .

The lower bound of the array is always zero.

Description

ReDim statements are typically used to specify or modify the size of dynamic arrays that have been formally declared with Private, Public, or Dim statements with empty parentheses (without dimensional subscripts). You can use the ReDim statement repeatedly to change the array dimension and the number of elements.

If you use the Preserve keyword, you can only resize the last dimension of the array, and you cannot change the dimension of the array. For example, if the array has only one dimension, you can modify the size of the array because that dimension is the last and only one. However, if the array has two or more dimensions, you can only change the size of the last dimension and retain the contents of the array.

This example shows how to increase the termination dimension of a dynamic array without erasing the data that exists in the array.

ReDim X (10,10,10). . Redim Preserve X (10, 10, 15) be careful that if you reduce the size of the array, you will lose the data in the excluded elements.

When the variable is initialized, the numeric variable is initialized to 0 and the string variable is initialized to a zero-length string ("). Before you can use a variable that references an object, you must use the Set statement to assign an existing object to the variable. Before object assignment, declared object variables have a specific value of Nothing.

Thank you for reading, the above is the content of "the usage of ReDim sentence in VBS". After the study of this article, I believe you have a deeper understanding of the usage of ReDim sentence in VBS, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report