|
-
Apr 25th, 2002, 09:04 AM
#1
Thread Starter
Frenzied Member
VBScript ReDim
***?!!!
Code:
Dim myArray()
ReDim Preserve myArray(x, y)
ReDim Preserve myArray(x + 1, y) 'Gives a subscript out of range error
ReDim Preserve myArray(x, y + 1) 'Works!
I'd hate to see what happens to a three deminsional array.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Apr 25th, 2002, 09:18 AM
#2
Fanatic Member
From MSDN (Visual Basic Scripting Edition : ReDim Statement)
The ReDim statement is used to size or resize a dynamic array that has already been formally declared using a Private, Public, or Dim statement with empty parentheses (without dimension subscripts). You can use the ReDim statement repeatedly to change the number of elements and dimensions in an array.
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.
So same as VB then!
-
Apr 25th, 2002, 09:58 AM
#3
Thread Starter
Frenzied Member
Originally posted by Jerry Grant
So same as VB then!
I guess VB sucks, too.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Apr 25th, 2002, 11:03 AM
#4
Frenzied Member
yep, i know it suck, you'll need to use a tmp array!
Dim myArray()
Dim tmpArray()
ReDim Preserve myArray(x, y)
ReDim tmpArray(x + 1, y)
tmpArray=myArray()
Erase myArray
myArray=tmpArray()
Erase tmpArray
this should work, i did'nt test it, and never tried it!!
not sure if you really need to use this line
Erase myArray
but i think you need too, not sure!
let me know
-
Apr 25th, 2002, 01:05 PM
#5
Thread Starter
Frenzied Member
I just transposed all my arrays. I only needed to scale the one axis, but because of the type of data in there, it just made since in my mind that that axis be the first.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
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
|