我声明了我的数组:
Dim invoice_discountitems(100, 1) As String
现在我将值设置到数组中:
invoice_discountitems(0,0) = "test1"
invoice_discountitems(0,1) = "test2"
invoice_discountitems(1,0) = "test3"
invoice_discountitems(1,1) = "test4"
现在我试着计算元素:
MsgBox(invoice_discountitems.GetLength(0) - 1)
但它显示我要显示的数组大小(100,1)(2)元素
答案 0 :(得分:1)
您正在显示数组第一个维度的长度而不是第二个
MsgBox( invoice_discountitems.GetLength(1) ) ' displays 2 '
http://msdn.microsoft.com/en-us/library/system.array.getlength.aspx