Archived

This topic is now archived and is closed to further replies.

Is it at all possible to use vectors in VB6?

This topic is 5753 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Not sure I understand your question, but you might want to read up on Redim and Redim Preserve.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites