I want to initialize a array
de String
with a size taken from a variable, but it gives me the error:
Illegal array bound for: denominations
This is the code:
Dim size As Integer
size = vista.EntryCount 'return Integer'
Dim denominaciones( size ) As String
If instead of putting the variable size
I put a numerical value how it 100
works.
Dim denominaciones( 100 ) As String
I have tried putting:
Dim denominaciones( 1 to size) As String
But nothing...
I have also tried to initialize the array
and then resize it with Redim
but neither.
How can I put a variable as size for the array?
With
Redim
if it works, at least with this example that I just made. One thing to keep in mind is that array declarations cannot be done dynamically, they need a literal connotation (string, integer, variant, etc.).That is, we can declare the array without a limit (although it has a limit) and then resize it.
I put the example that I just did and that works perfectly.