|
-
Aug 24th, 2010, 05:21 AM
#1
Thread Starter
Hyperactive Member
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.
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
-
Aug 24th, 2010, 05:53 AM
#2
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
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.

-
Aug 24th, 2010, 06:40 AM
#3
Re: Multidimension Array : Subscription out of range
you can only redimension the last dimension of a multi dimensional array with preserve
from msdn
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.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 24th, 2010, 07:08 PM
#4
Thread Starter
Hyperactive Member
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?
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
-
Aug 24th, 2010, 07:38 PM
#5
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.
-
Aug 24th, 2010, 07:43 PM
#6
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|