09-26-2005, 01:24 AM
completely noob question here, but when i redim something it's original contents are deleted. How can i prevent this?
url=http://www.sloganizer.net/en/][/url]
redimming deletes original contents
|
09-26-2005, 01:24 AM
completely noob question here, but when i redim something it's original contents are deleted. How can i prevent this?
url=http://www.sloganizer.net/en/][/url]
09-26-2005, 02:37 AM
If you're compiler takes it you should be able to do:
REDIM PRESERVE VariableName AS DataType that should keep it's contents.
hen they say it can't be done, THAT's when they call me ;-).
need hosting: http://www.jc-hosting.net All about ASCII: http://www.ascii-world.com
09-26-2005, 03:07 AM
only qb7.1 version alows that. qb45 won't so if your working with 4.5 version you will need to keep a temp array to store the old contain while your rediming the the main array.
09-26-2005, 09:05 PM
Yes, Freebasic can do REDIM Preserve :-)
hen they say it can't be done, THAT's when they call me ;-).
need hosting: http://www.jc-hosting.net All about ASCII: http://www.ascii-world.com
09-28-2005, 04:27 AM
Just out of curiosity, why are you doing a REDIM in the first place?
*****
09-28-2005, 08:13 PM
Quote:Just out of curiosity, why are you doing a REDIM in the first place? For some reason when i tried to use DIM SHARED it didn't work...dunno why. It seems to be working now....come to think of it i recently deleted and rewrote a large part of the sub, maybe i fixed something that was broken...
url=http://www.sloganizer.net/en/][/url]
09-29-2005, 12:04 AM
if you need to do it in qb45, as it doesnt support PRESERVE, you can copy the array contents to temporary array of same size, redim the array and then copy back from the temporary. Thats how I used to pull it off. And im sure how many others did as well.
|
« Next Oldest | Next Newest »
|