Control Arrays and Retrieving Values
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!
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.
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.
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement