How can I create an empty one-dimensional string array?
VB is 0-indexed in array declarations, so seomthing like Dim myArray(10) as String
gives you 11 elements. It's a common mistake when translating from C languages.
So, for an empty array, either of the following would work:
Dim str(-1) as String ' -1 + 1 = 0, so this has 0 elements Dim str() as String = New String() { } ' implicit size, initialized to empty
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With