473,808 Members | 2,882 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ReDim Problem

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

/ListCGShowsGrou ped.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(intCol s + 1, introws)
--
------------------------------------
Wayne Wengert
wa***@wengert.o rg
Jul 19 '05 #1
2 15892
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" <wa********@wen gert.com> wrote in message
news:uR******** ******@tk2msftn gp13.phx.gbl...
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

/ListCGShowsGrou ped.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(intCol s + 1, introws)
--
------------------------------------
Wayne Wengert
wa***@wengert.o rg

Jul 19 '05 #2
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" <ch***@blue-canoe.co.uk.NOS PAM> wrote in message
news:u2******** ******@TK2MSFTN GP10.phx.gbl...
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" <wa********@wen gert.com> wrote in message
news:uR******** ******@tk2msftn gp13.phx.gbl...
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

/ListCGShowsGrou ped.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(intCol s + 1, introws)
--
------------------------------------
Wayne Wengert
wa***@wengert.o rg

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
7984
by: Trevor Fairchild | last post by:
I've got a program that parses text files. The text files come to me in Unicode and they contain goofy characters that VB chokes on - treats them as eof markers. I have already been through this issue in another thread and I have received an answer that works (code is below) However, my test data thus far has been in the 10-50MB size range. I now have a case where the text file is 650MB in size! I need to convert it to ANSI for my...
10
1398
by: Nathan Sokalski | last post by:
I have an Array that I will be resizing with the ReDim statement. For some reason that I cannot figure out, I am recieving the following error: The code that this occurs in is as follows: Dim NavButton As NavButtonInfo Dim TempButtons() As NavButtonInfo
4
1667
by: Daryl Davis | last post by:
I am having trouble with ReDim (see code below) SaleTable2's structure includes an array for SaleDetailTable2 Dim newsale As New hallsales.SaleTable2 Dim detail As New hallsales.SaleDetailTable2 Try redim newsale.SaleDetails(0) ********* This line comes out with an error "Redim statement requires Array" *************
9
5705
by: John A Grandy | last post by:
In VB6 you could get away with the following code: Dim Index As Integer Dim ItemsCount As Integer Dim StringArray() As String Dim StringValue As String '....
19
3159
by: Tom Jastrzebski | last post by:
Hello, I was just testing VB.Net on Framework.Net 2.0 performance when I run into the this problem. This trivial code attached below executed hundreds, if not thousand times faster in VB 6.0 than in .Net environment, under VS 2005 Beta 2. Does anyone have any idea whether this will be addressed in the final release? Thanks, Tomasz
2
2072
by: Fredrik Strandberg | last post by:
I have not been able to find the solution of this problem anywhere: I am building a class PrivateHelper that provides methods to access private members and invoke private methods, to be used for testing. In a particular test case, an array is passed to the Method Under Test, and then that MUT performs a ReDim on the array. The test code then needs to check the array, but the effect of the ReDim statement does not propagate to the test...
9
5360
by: Anil Gupte | last post by:
I am having a problem using Multidim arrays. I want to create an array which as I understand it is dimensioned as: dim xyz (rows,columns) as String I want to populate it with rows from a table in a database. I don't know how many rows I am getting so of course I have to Redim inside the loop that does this. Unfortunately, the error message and documentation say: "In a
1
1885
by: Freddy Coal | last post by:
Hi, I don't know how redim an array, My problem whit an example: I define my array Dim Ary as array I put three elements inside my array Ary = Split("one,two,three", ",")
2
2943
by: eBob.com | last post by:
I was changing some code in a multi-threaded application today and noticed that it was not locking where it really needed to be locking. The Sub was already working with an array so I just stuck a SyncLock ArrayName.SyncRoot at the beginning of the Sub and an End SyncLock at the end. But this caused the application to produce no output (an Excel spreadsheet)! After some screwing around, sorry ... I mean experimenting, I noticed that the...
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.