Multidimension Array : Subscription out of range
Hi All,
I have defined an Array in global with 2 Dimension.
However, I'm getting error message "Subscription out of range"
I did a search from internet I found there is not allowed to preserve the multi dimension array unless the row is fixed.
Example,
Dim MultiDimension() as string
redim preserve MultiDimension (0,1) --> "ALLOWED"
redim preserve MultiDimension (0,2) --> "ALLOWED"
redim preserve MultiDimension (1,2) --> "not ALLOWED"
Anyone here have resolution to overcome my problem?
Mind to share it? Thank you very much.
Re: Multidimension Array : Subscription out of range
It's best if you know how many row/columns you need.
i.e
Dim MultiDimension(4,5) as string
Re: Multidimension Array : Subscription out of range
you can only redimension the last dimension of a multi dimensional array with preserve
from msdn
Quote:
If you use the Preserve keyword, you can resize only the last array dimension and you can't change the number of dimensions at all. For example, if your array has only one dimension, you can resize that dimension because it is the last and only dimension. However, if your array has two or more dimensions, you can change the size of only the last dimension and still preserve the contents of the array. The following example shows how you can increase the size of the last dimension of a dynamic array without erasing any existing data contained in the array.
Re: Multidimension Array : Subscription out of range
Thanks all,
If I want to store the values in multi dimension array or some others method as global variable.
Any others way could be used?
Re: Multidimension Array : Subscription out of range
A multicolumned listview? But in that case you need a form to be always loaded on which the listview will be to use it "globaly" and at all times.
Re: Multidimension Array : Subscription out of range
Typically a udt array will solve this problem. What kind of data are you trying to put in the array?