Is it at all possible to use vectors in VB6?
Because I need to declare an multi-dimensional array during runtime, and the size is up to the user. Of course, I have to use constants to declare the array, so the best solution I''ve come up with so far is to have the user specify the size of the array, and place data in every element just outside the bounds of what the user entered to be the stopping point of the array (In other words, if the save function is running and it comes to an element that specifies the end of a row or column, the function continues on the next row or column).
But is there any way to use a vector? That would make things much easier.
Not sure I understand your question, but you might want to read up on Redim and Redim Preserve.
You can create a user defined type or a class to store and manipulate vector positions...
type vector
x as long
y as long
z as long
d as long
end type
hope that helps...
type vector
x as long
y as long
z as long
d as long
end type
hope that helps...
You can create a user defined type or a class to store and manipulate vector positions...
type vector
x as long
y as long
z as long
d as long
end type
hope that helps...
type vector
x as long
y as long
z as long
d as long
end type
hope that helps...
You can declare a multi-dimensional array simply by omitting the bounds:
Dim MyDynamicArray() As [Type]
Then use ReDim and ReDim Preserve to resize it; I won''t go into detail here.
As for a vector, what VB provides is not quite the same but will do. Use the built in Collection class:
Dim MyVector As New Collection
It will allow a variable number of objects and any type of objects.
____________________________________________________________
Direct3D vs. OpenGL
Dim MyDynamicArray() As [Type]
Then use ReDim and ReDim Preserve to resize it; I won''t go into detail here.
As for a vector, what VB provides is not quite the same but will do. Use the built in Collection class:
Dim MyVector As New Collection
It will allow a variable number of objects and any type of objects.
____________________________________________________________
Direct3D vs. OpenGL
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement