以语句dim a(3 ,-2 to 2 ,5)为例:
Option Base 1
Private Sub Form_Click()
Dim i As Integer, j As Integer, k As Integer
Dim count As Long
Dim a(3, -2 To 2, 5) As Integer
For i = LBound(a, 1) To UBound(a, 1)
For j = LBound(a, 2) To UBound(a, 2)
For k = LBound(a, 3) To UBound(a, 3)
count = count + 1
Next k
Next j
Next i
MsgBox count
End Sub
扩展资料:
vb常用函数:
Len(x)求字符串的长度(字符个数)
LenB(x)求字符串的字节个数
Mid(x,n1,n2)从x字符串左边第n1个位置开始向右取n2个字符
Left(x,n)从x字符串左边开始取n个字符
Right(X,n)从x字符串右边开始取n个字符
String(n,x)返回由n个首字符组成的字符串
Space(n)返回n个空格
Now返回系统日期和时间
Year(c)返回指定日期的年份
Minute()返回指定时间的分数
Chr(x)将数值(ASCII码)转换为字符
CBool(x)将数字字符串或数值转换成布尔型
参考资料来源:百度百科-Visual Basic
Dim A(6, 6) As Integer定义的数组包含的元素个数是49,二维数组,长宽都是是7
Dim B(10 To 20) 定义的数组元素个数是11,UBound(数组名)-LBound(数组名)+1,20-10+1=11
a10(5)相当于在一维数组的5个点
b (3,4)相当于在二维数组里的12个点(x轴上三个点,y轴上四个点)
c (1 to 5,2 to 4, 3 to 6)相当于在三维数组里的60个点(5×3×4)
dim a10(5):一维数组,限5;整型
dim b(3,4):二维,限3,4;整型
dim c(1 to 5,2 to 4,3 to 6):三维,限5,3,4