如何清除整个阵列? [英] How to clear the entire array?
本文介绍了如何清除整个阵列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个这样的数组:
Dim aFirstArray() As Variant
我如何清除整个数组?结果
有关集合什么?
How do I clear the entire array?
What about a collection?
推荐答案
您既可以使用擦除
或使用ReDim
语句来清除数组:
You can either use the Erase
or ReDim
statements to clear the array:
Dim threeDimArray(9, 9, 9), twoDimArray(9, 9) As Integer
Erase threeDimArray, twoDimArray
ReDim threeDimArray(4, 4, 9)
See the different usage of each method here.
更新
要删除的集合,你迭代其项目并使用删除
方法:
To remove a collection, you iterate over its items and use the remove
method:
For i = 1 to MyCollection.Count
MyCollection.Remove 1 ' Remove first item
Next i
这篇关于如何清除整个阵列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文