-
Variable based array size
Please any one tell me how to create array which has the size that is based
on a value of a variable.
cODe:
Dim x
x=4
Dim myArr(x)
Does not work and asks for literal variable in the array size specification.
-
Re: Variable based array size
dim myArr()
ReDIm myArr(x)
--
"Don't try to be like Jackie. There is only one Jackie...Study computers
instead."
- Jackie Chan
http://www.aspfaq.com/
http://www.aspfree.com/authors/adrian/
-
Re: Variable based array size
Hi Nikhil,
You can try the instruction ReDim instead of Dim. (use Dim first to declare
the array)
ReDim works with variables or constants.
if you have already data in the array, use the keyword Preserve:
Redim Preserve MyArray (VariableDim)
"Nikhil" <nikhil_kulkarni@dacafe.com> wrote:
>
>Please any one tell me how to create array which has the size that is based
>on a value of a variable.
>
>cODe:
>
>Dim x
>x=4
>Dim myArr(x)
>
>Does not work and asks for literal variable in the array size specification.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|