Reputation: 1830
I Declared my Array like this:
Dim invoice_discountitems(100, 1) As String
Now i set values into the array:
invoice_discountitems(0,0) = "test1"
invoice_discountitems(0,1) = "test2"
invoice_discountitems(1,0) = "test3"
invoice_discountitems(1,1) = "test4"
Now I tried to count the elements:
MsgBox(invoice_discountitems.GetLength(0) - 1)
But it display the array size (100,1) I want to display (2) elements
Upvotes: 0
Views: 373
Reputation: 460108
You are displaying the length of the first dimension of the array not the second
MsgBox( invoice_discountitems.GetLength(1) ) ' displays 2 '
http://msdn.microsoft.com/en-us/library/system.array.getlength.aspx
Upvotes: 1