|
-
August 18th, 1999, 05:28 AM
#1
redim instruction
Hi,
does anybody know if the 'REDIM' instruction
can be applied to an array? (to change his lenght). And if it can,
does the arra
-
August 18th, 1999, 06:31 AM
#2
Re: redim instruction
use the Redim Preserve Syntax to redimension an array and keep its values as in
dim a() as integer
redim preserve a(10)
-
August 18th, 1999, 10:52 AM
#3
Re: redim instruction
Hi,
Yes! Redim instruction is part of the array use.
There are static and dynamic arrays.
Most programmers don't use static arrays because one rarely knows at compile time how many items you
need and also because static arrays can't be resized (with Redim) during execution.
You declare and create dynamic arrays in two distinct steps. In general, you DECLARE the array to account for
its visibility (e.g at the beginning of a module if you want to make it visible by all the procedures in the module), using
a DIM command with an empty pair of brackets.
Then you create an array when you actually need it, using the <ReDim> statement.
'Array defined in a BAS modul
Dim Customers() as String
Sub Main()
'Here you create the array
Redim Customer(1000) as String
End Sub
Dynamic arrays can be recreated at will.
If you want to resize an array witghout losing its contents, use <Redim Preserve>
Redim Preserve Customers(2000) as String
OK?
Jan
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
|
Click Here to Expand Forum to Full Width
|