|
-
Aug 28th, 2000, 02:34 PM
#1
Thread Starter
Lively Member
I'm learning VB, how can I declare and use arrays of variables.
Thanx
-
Aug 28th, 2000, 02:38 PM
#2
Monday Morning Lunatic
There is more than one way.
1st way - define top boundary
Code:
Dim vsMyStrings(5) as String
vsMyStrings(0) = "First String"
vsMyStrings(5) = "Last String"
2nd way - define index ranges
Code:
Dim vsMyStrings(5 to 9) as String
vsMyStrings(5) = "A string"
vsMyStrings(9) = "Another string"
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 28th, 2000, 02:40 PM
#3
Code:
Dim iArray(4) As Integer
iArray(0) = 1
iArray(1) = 2
iArray(2) = 3
iArray(3) = 4
iArray(4) = 5
'etc.
-
Aug 28th, 2000, 02:40 PM
#4
Thread Starter
Lively Member
-
Aug 28th, 2000, 08:59 PM
#5
Also have a look at
ReDim Preserve MyArray ..... way cool enhancement to vb5.
Also you might like to have a look at multi-dimension arrays
Code:
Dim MyArray(4,4).
For X = 0 to 4
For Y = 0 to 4
MyArray(X,Y) = whatever
Next Y
Next x
Cool if you want to hold in memory something like a number of CDs with the tracks on each cd.
Hope that gives you some more pointers
-
Aug 28th, 2000, 09:55 PM
#6
Fanatic Member
There is an array tutorial which goes into some detail on this site.
http://www.vb-world.net/articles/arrays/
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
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
|