Dynamic Data Structures: Dynamic Arrays? 
Author Message
 Dynamic Data Structures: Dynamic Arrays?

VBScript fails as the definition expects an integer data constant...

Dim iArrayIndex
       iArrayIndex = 1

Dim aArray(iArrayIndex)
aArray(0) = "Zero"
aArray(1) = "One"

Response.Write "aArray(0): " & aArray(0) & "<br />"
Response.Write "aArray(1): " & aArray(1) & "<br />"

I need to learn to create dynamic arrays. My example shows
a single dimension but my application requires two dimensions
where the second index must be created dynamically i.e. aArray(5,i).

Can somebody explain how to do this with VBScript or
provide a document resource where I can learn to create a
dynamic array or a dynamic data structure that will allow me to
achieve the same results as a two dimensional array?

--
<%= Clinton Gallagher
         A/E/C Consulting, Web Design, e-Commerce Software Development
         Wauwatosa, Milwaukee County, Wisconsin USA

         URL http://www.*-*-*.com/

         LaGarde StoreFront 5 Affiliate: e-Commerce Software Development
         SEE: http://www.*-*-*.com/



Mon, 12 Sep 2005 00:56:47 GMT  
 Dynamic Data Structures: Dynamic Arrays?

Quote:

> VBScript fails as the definition expects an integer data constant...

> Dim iArrayIndex
>        iArrayIndex = 1

> Dim aArray(iArrayIndex)
> aArray(0) = "Zero"
> aArray(1) = "One"

> Response.Write "aArray(0): " & aArray(0) & "<br />"
> Response.Write "aArray(1): " & aArray(1) & "<br />"

> I need to learn to create dynamic arrays. My example shows
> a single dimension but my application requires two dimensions
> where the second index must be created dynamically i.e. aArray(5,i).

> Can somebody explain how to do this with VBScript or
> provide a document resource where I can learn to create a
> dynamic array or a dynamic data structure that will allow me to
> achieve the same results as a two dimensional array?

ReDim Statement
http://msdn.microsoft.com/library/en-us/script56/html/vsstmredim.asp

Windows Script Documentation
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207...

Dim iArrayIndex
iArrayIndex = 1

Dim aArray()
ReDim aArray(iArrayIndex)

aArray(0) = "Zero"
aArray(1) = "One"

Response.Write "aArray(0): " & aArray(0) & "<br />"
Response.Write "aArray(1): " & aArray(1) & "<br />"

--
Steve

The whole problem with the world is that fools and fanatics are always so
certain of themselves, and wiser people so full of doubts. -Bertrand Russell



Mon, 12 Sep 2005 03:30:37 GMT  
 Dynamic Data Structures: Dynamic Arrays?
Better late than never Steve. Thanks for your response.
I forgot I even posted the message.

--
<%= clintonG

        URL http://www.metromilwaukee.com/clintongallagher/

Quote:


> > VBScript fails as the definition expects an integer data constant...

> > Dim iArrayIndex
> >        iArrayIndex = 1

> > Dim aArray(iArrayIndex)
> > aArray(0) = "Zero"
> > aArray(1) = "One"

> > Response.Write "aArray(0): " & aArray(0) & "<br />"
> > Response.Write "aArray(1): " & aArray(1) & "<br />"

> > I need to learn to create dynamic arrays. My example shows
> > a single dimension but my application requires two dimensions
> > where the second index must be created dynamically i.e. aArray(5,i).

> > Can somebody explain how to do this with VBScript or
> > provide a document resource where I can learn to create a
> > dynamic array or a dynamic data structure that will allow me to
> > achieve the same results as a two dimensional array?

> ReDim Statement
> http://msdn.microsoft.com/library/en-us/script56/html/vsstmredim.asp

> Windows Script Documentation
> http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207...

> Dim iArrayIndex
> iArrayIndex = 1

> Dim aArray()
> ReDim aArray(iArrayIndex)

> aArray(0) = "Zero"
> aArray(1) = "One"

> Response.Write "aArray(0): " & aArray(0) & "<br />"
> Response.Write "aArray(1): " & aArray(1) & "<br />"

> --
> Steve

> The whole problem with the world is that fools and fanatics are always so
> certain of themselves, and wiser people so full of doubts. -Bertrand Russell



Mon, 10 Oct 2005 10:45:37 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Dynamic Arrays in Structures

2. dynamic arrays within a structure

3. VB4 - Passing a structure with dynamic arrays to a DLL

4. Dynamic arrays within a structure

5. Dynamic ADO Recordset Not Dynamic (Does Not Refresh Data)

6. Dynamic ADO Recordset Not Dynamic (Does Not Refresh Data)

7. Dynamic Data Structures

8. Dynamic Data Structure

9. Dynamic memory handling and data structures in VB

10. Passing data in a Dynamic Array to a Stored Procedure

11. Dynamic array within an array?

12. Dynamic Structures with Session Scope Problem.

 

 
Powered by phpBB® Forum Software