Jump to content
  • Advertisement


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


Control Arrays and Retrieving Values

This topic is 6151 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

Ok, here it goes- I created an array named "Box()" and everytime the user drags and clicks the array is redimensioned one larger and a new shape will be created and appear. After the user creates all the Shapes they want I run this code: Dim Z For Each Z in Box Debug.Print str(z.Left) & ", " & str(z.top), .... Next Z I put the (...) because it goes on for a while, but anyway... Every time I run this code there are no values for any of the objects except the last one. If thats not clear, tell me... Any ideas? If one person would write a book on DirectX in VB, I would make them a rich man!

Share this post

Link to post
Share on other sites
Hmmm, well I think this code is working correctly. Are you sure you''ve assigned values to all items in the box() array? If you program still doesn''t work, you can also do something like this:

dim i as integer

for i = box.lbound to box.ubound
debug.print "item" + str(i)
next i

I don''t know if this is completely correct, but it should be like this I guess.

Share this post

Link to post
Share on other sites
I assume you''re redeclaring your array each time you need to resize it, but when you Dim a variable, it loses any of its old values..

However, there is a keyword you can place in your declaration line that preserves the old values in an array..I forget what the syntax/word is, it was something like either..

Redim array[x+1];
Dim array[x+1] Preserve;

or something..try a google search

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!