473,466 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can I add rows to an already dimensioned 2d array

Is the following assumption correct?

If I setup an array with 5 rows and 8 columns.

Private invoiceItemsArray
ReDim invoiceItemsArray(4,7)

Am I stuffed if I want to add a fifth row? From what I've
read I will only be able to add more columns in this
instance.

Is this correct? And if so is there a work-a-round.
Would I need to create a new array with one extra row, use
the old one to populate it and then add my new row data?

TIA,

Colin


Jul 19 '05 #1
4 4818
Colin Steadman wrote:
Is the following assumption correct?

If I setup an array with 5 rows and 8 columns.

Private invoiceItemsArray
ReDim invoiceItemsArray(4,7)

Am I stuffed if I want to add a fifth row? From what I've
read I will only be able to add more columns in this
instance.

Is this correct?
Yes, that is correct.
And if so is there a work-a-round.


Yes, reverse your definitions of "rows" and "columns"

Private invoiceItemsArray
ReDim invoiceItemsArray(7,4)
....
ReDim invoiceItemsArray(7,5)
HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #2
Will there always be 8 columns?

If so, either reverse the subscripts so that "column" is the first subscript
or use a one-dimensional array and compute the offsets as in:

col1val = invoiceItemsArray( nRow*8 )
col2val = invoiceItemsArray( nRow*8 + 1)
col3val = invoiceItemsArray( nRow*8 + 2)

etc.

If both subscript ranges are variable and you cannot put an upper bound on
one or the other then you will probably have to create a new array and copy
the existing data to increase the array size.
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Colin Steadman" <ms**@N0Tpart0FemailADdRESSScolinsteadman.com> wrote in
message news:e1****************************@phx.gbl...
Is the following assumption correct?

If I setup an array with 5 rows and 8 columns.

Private invoiceItemsArray
ReDim invoiceItemsArray(4,7)

Am I stuffed if I want to add a fifth row? From what I've
read I will only be able to add more columns in this
instance.

Is this correct? And if so is there a work-a-round.
Would I need to create a new array with one extra row, use
the old one to populate it and then add my new row data?

TIA,

Colin

Jul 19 '05 #3
>
Yes, reverse your definitions of "rows" and "columns"

Private invoiceItemsArray
ReDim invoiceItemsArray(7,4)
....
ReDim invoiceItemsArray(7,5)

Damn, I knew something wasn't right. This is really
starting to get confusing. I'm going to drop this
completely for the moment, go home and work on it again
tomorrow morning when the mist has cleared.

Thank you.

Colin
Jul 19 '05 #4
'Use a Disconnected Recordset to manage the data
Set rs = CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.CursorType = adOpenStatic
rs.fields.append "TEXT1",200,15
rs.fields.append "NUM1",5

'APPEND AS MANY FIELDS AS NEEDED
rs.Open

'ADD RECORDS AS NEEDED
rs.AddNew

'DO WHAT EVER WITH THE DATA

'CLEAN UP
Set rs = Nothing
'dlbjr

'Discerning resolutions for the alms
Jul 19 '05 #5

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

Similar topics

6
by: Brendan.Collins | last post by:
Hi I have a javascript problem that has been annoying me for two days now and thought that a javascript expert might have the magic solution. I am populating a table dynamically from the...
15
by: Gregg Woodcock | last post by:
My compiler (m68k-gcc) does not allow this (simplified example; not my real code) and I don't see why not: { char *arrayCharPtr1 = {"a", "ab", NULL}; char *arrayCharPtr2 = {"A", "AB", NULL};...
6
by: dddddddd2444444 | last post by:
Hi,please help... It works fine when I define a 2-D array like char code. But it won't work when I try to define the array dynamically using a function. It just crashes. Does anyone know why?...
5
by: Geoff Jones | last post by:
Hi Suppose we have an array of DataRows e.g. Dim drMyRows() As DataRow = myTable.Rows(0).GetChildRows("PricesCompany") generated via a relationship. The question I have is this. Isn't...
12
by: Graham Blandford | last post by:
Hi all, Would someone be able to tell me the most 'graceful' way of removing unwanted rows from a dataset based on a condition prior to update? OR, resetting the rows all to unchanged after they...
68
by: Martin Joergensen | last post by:
Hi, I have some files which has the following content: 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0
3
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some...
5
by: Richard Lewis Haggard | last post by:
I am trying to create multi-dimensioned arrays in conventional ASP pages and pass these arrays as arguments to functions that are in a C# interop assembly. ASP complains because it doesn't...
11
by: sanju | last post by:
Hi all, I am new in the world of javascript. Someone plz help me. I have two tables containing 30 rows each. In first table there is checkbox and in the second table there is radio buttons ahead...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.