Is it at all possible to use vectors in VB6?

Started by
5 comments, last by X_Breaker 22 years ago
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.
Advertisement
You should check out Collections, they will do what you are lookng for.
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...
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...
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
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Thanks, I''ll try these out.

This topic is closed to new replies.

Advertisement