|
-
Apr 2nd, 2003, 03:51 PM
#1
Thread Starter
Addicted Member
create an aray on the fly
im building a directX program that will load a map in memory, i want to be able to store if in a 3D array ( eg: map(x,y,z) ) but i dont know the size of the array untill i read the map file
here's the possible dimmensions
10 <= X <= 255
10 <= Y <= 255
1 <= Z <= 3
*Rudy^
Visual Studio 6 Ent. SP5
Windows 2000 SP4
Windows XP SP1a
-
Apr 2nd, 2003, 03:54 PM
#2
Let me in ..
Re: create an aray on the fly
Originally posted by Rudy
im building a directX program that will load a map in memory, i want to be able to store if in a 3D array ( eg: map(x,y,z) ) but i dont know the size of the array untill i read the map file
here's the possible dimmensions
10 <= X <= 255
10 <= Y <= 255
1 <= Z <= 3
VB Code:
Option Explicit
Private Sub Form_Load()
Dim l_strArray() As String
ReDim l_strArray(0)
l_strArray(UBound(l_strArray)) = "First Element"
ReDim Preserve l_strArray(UBound(l_strArray) + 1)
l_strArray(UBound(l_strArray)) = "Second Element"
ReDim Preserve l_strArray(UBound(l_strArray) + 1)
l_strArray(UBound(l_strArray)) = "Nth Element"
Dim i As Integer
For i = LBound(l_strArray) To UBound(l_strArray)
MsgBox l_strArray(i)
Next
End Sub
This should give you enough idea !!!
-
Apr 2nd, 2003, 03:56 PM
#3
Thread Starter
Addicted Member
this works only on a 1D array
you cant do it with a 3D array
*Rudy^
Visual Studio 6 Ent. SP5
Windows 2000 SP4
Windows XP SP1a
-
Apr 2nd, 2003, 04:16 PM
#4
Fanatic Member
true. on a multi-dimensional array you can only redim the last dimension of the array. i would suggest using arrays of UDT's if possible.
there are 2 reasons why i leave my work unfinished:
(1) i'm getting old.
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
|