123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home

Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)

Forums

   Computer Science / IT

   Electronics

   Electrical

   Mechanical

   Chemical

   Civil

   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs

Sitemap

About-Us

Terms of use

Displaying  Source Code(s)  
 

 
Arrays to store data

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

Description : Assigning an array size with a variable produces a variable unless the Redim command is used. Method #1: You know the size Method #2: the size is in a variable

<html><head>
<title>arraysredim.asp</title>
</head><body bgcolor="#FFFFFF">
<%
' this code
Dim a_array(100)

' this code will fail
x=100
Dim my_array(x)

%>
</body></html>


Assigning an Array size With a variable produces an Error unless the ReDim command Is used.

<html><head>
<title>arraysredimcorrect.asp</title>
</head><body bgcolor="#FFFFFF">
<%
Dim my_array()
x=100
ReDim preserve my_array(x)
my_array(20)="Hi!"
my_array(40)="How are You"

lowcount=LBound(my_array)
highcount=UBound(my_array)
Response.Write "lowcount=" & lowcount & ";highcount=" & highcount & "<p>"
For counter=lowcount To highcount
Response.Write counter & " "
Response.Write my_array(counter) & "<BR>
Next

%>
</body></html>
 

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG