Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ReDim Problem

Reply
Thread Tools

ReDim Problem

 
 
Wayne Wengert
Guest
Posts: n/a
 
      10-30-2003
I am trying to add one column to an existing array (code below). The ReDim
command gives the error:
-----------------------------------------------
Microsoft VBScript runtime error '800a0009'

Subscript out of range

/ListCGShowsGrouped.asp, line 58

------------------------------------------------

The Response.Write shows that the array has 9 rows and 3 cols (it displays 8
and 2) before the redim and I want a 9 x 4 after the redim.

What am I doing wrong here?



============ Code ===============

........
aryShows = myRS.GetRows
intRows = Ubound(aryShows,2)
intCols = Ubound(aryShows,1)
MyRS.Close

Response.Write("Rows: " & introws & " - Cols: " & intcols & "<br>")
Redim Preserve aryShows(intCols + 1, introws)
--
------------------------------------
Wayne Wengert



 
Reply With Quote
 
 
 
 
Chris Barber
Guest
Posts: n/a
 
      10-30-2003
You can only redimension the last dimension of an array.

<quote source="google search">
When using multi dimensional arrays, it is only possible to redim the last
dimension.

Say you array looks like this:

Dim myArr()
Redim myArr(5,5)

You will be able to do

Redim myArr(5,10)

But you won't be able to do

Redim myArr(10,5)

This behaviour is by design, so you can't get around it...
</quote>

Hope this helps (or not of course).

Chris.

"Wayne Wengert" <> wrote in message
news:...
I am trying to add one column to an existing array (code below). The ReDim
command gives the error:
-----------------------------------------------
Microsoft VBScript runtime error '800a0009'

Subscript out of range

/ListCGShowsGrouped.asp, line 58

------------------------------------------------

The Response.Write shows that the array has 9 rows and 3 cols (it displays 8
and 2) before the redim and I want a 9 x 4 after the redim.

What am I doing wrong here?



============ Code ===============

........
aryShows = myRS.GetRows
intRows = Ubound(aryShows,2)
intCols = Ubound(aryShows,1)
MyRS.Close

Response.Write("Rows: " & introws & " - Cols: " & intcols & "<br>")
Redim Preserve aryShows(intCols + 1, introws)
--
------------------------------------
Wayne Wengert




 
Reply With Quote
 
 
 
 
Wayne Wengert
Guest
Posts: n/a
 
      10-30-2003
Thanks Chris. Now that you remind me of that I do remember reading that
before - I forgot about that (senility!). Oh well, I'll do it the hard way.

Wayne

"Chris Barber" <> wrote in message
news:...
> You can only redimension the last dimension of an array.
>
> <quote source="google search">
> When using multi dimensional arrays, it is only possible to redim the last
> dimension.
>
> Say you array looks like this:
>
> Dim myArr()
> Redim myArr(5,5)
>
> You will be able to do
>
> Redim myArr(5,10)
>
> But you won't be able to do
>
> Redim myArr(10,5)
>
> This behaviour is by design, so you can't get around it...
> </quote>
>
> Hope this helps (or not of course).
>
> Chris.
>
> "Wayne Wengert" <> wrote in message
> news:...
> I am trying to add one column to an existing array (code below). The ReDim
> command gives the error:
> -----------------------------------------------
> Microsoft VBScript runtime error '800a0009'
>
> Subscript out of range
>
> /ListCGShowsGrouped.asp, line 58
>
> ------------------------------------------------
>
> The Response.Write shows that the array has 9 rows and 3 cols (it displays

8
> and 2) before the redim and I want a 9 x 4 after the redim.
>
> What am I doing wrong here?
>
>
>
> ============ Code ===============
>
> .......
> aryShows = myRS.GetRows
> intRows = Ubound(aryShows,2)
> intCols = Ubound(aryShows,1)
> MyRS.Close
>
> Response.Write("Rows: " & introws & " - Cols: " & intcols & "<br>")
> Redim Preserve aryShows(intCols + 1, introws)
> --
> ------------------------------------
> Wayne Wengert
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
REDIM Preserve problem keyser soze ASP General 4 05-07-2008 02:51 PM
redim an array Stephen.Schoenberger@gmail.com C Programming 7 11-28-2007 10:18 PM
Redim an array (new / delete) adamrobillard@gmail.com C++ 4 12-03-2005 04:26 PM
Problem with ReDim statement Nathan Sokalski ASP .Net 10 05-17-2005 02:41 PM
Arrays resources (wa: Redim an array (object) - how?) Ante Perkovic ASP .Net 0 07-02-2003 01:05 PM



Advertisments