Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

1 dimensional array into 2 dimensional

Status
Not open for further replies.

Juddy58

Technical User
Jan 21, 2003
176
AU
Hi, I have a dynamic array astrEmailAddress which gets populated at run time with a list of email addresses eg,
astrEmailAddress(0) = "aa@aa.com"
astrEmailAddress(1) = "bb@bb.com"
astrEmailAddress(2) = "cc@cc.com"

Im need to turn this into a two dimensional array like,
astrEmailAddress(0,0) = "aa@aa.com"
astrEmailAddress(1,0) = ""

astrEmailAddress(0,1) = "bb@bb.com"
astrEmailAddress(1,1) = ""

astrEmailAddress(0,2) = "cc@cc.com"
astrEmailAddress(1,2) = ""

Where the second dimension will be a zero length string.
I have been trying to use Redim preserve but haven't had any luck. Just wondering if any one can help a lost soul out like usual:)
Thanks
Justin
 
You cannot change the number of dimensions when you use Preserve. Is it possible to take a step back and create the array with two dimensions?
 
if this is a array thats gets populated at run time
just declare it as multi dimensional
Code:
dim astrEmailAddress (x,2)

astrEmailAddress(0,0) = "aa@aa.com"
astrEmailAddress(1,0) = ""

astrEmailAddress(0,1) = "bb@bb.com"
astrEmailAddress(1,1) = ""

astrEmailAddress(0,2) = "cc@cc.com"
astrEmailAddress(1,2) = ""
 
Hi, thanks for the replys. I did solve the issue by declaring a dynamic multidimensional array (which I didn't know you could do!)and each time in my code there is a new email address I just redimmed it and added the new address to the array.
Thanks for the help everybody
Justin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top