Array Conversion vb 6 syntax not working with .net
-
I have an array called marr() its initialized with no parms and inside a for loop on vb6 i have t his syntax count = count + 1 ReDim Preserve marr(0 to count) marr(count) = var20 my problem is that i dont know how to write a .net 2003 version of that marr(0 to count) i have tried lookin online but havent found an answer... i appreciate any help... thanx in advance... Some times I bite way more than I can chew ... thats why i always buy cheese nips to keep me munching from dusk until dawn
-
I have an array called marr() its initialized with no parms and inside a for loop on vb6 i have t his syntax count = count + 1 ReDim Preserve marr(0 to count) marr(count) = var20 my problem is that i dont know how to write a .net 2003 version of that marr(0 to count) i have tried lookin online but havent found an answer... i appreciate any help... thanx in advance... Some times I bite way more than I can chew ... thats why i always buy cheese nips to keep me munching from dusk until dawn
Instead of
Redim Preserve
you could useArray.Resize(marr, count)
Regards, Martin -
I have an array called marr() its initialized with no parms and inside a for loop on vb6 i have t his syntax count = count + 1 ReDim Preserve marr(0 to count) marr(count) = var20 my problem is that i dont know how to write a .net 2003 version of that marr(0 to count) i have tried lookin online but havent found an answer... i appreciate any help... thanx in advance... Some times I bite way more than I can chew ... thats why i always buy cheese nips to keep me munching from dusk until dawn
ReDim Preserve still exists, but you've used the old VB6 syntax. All arrays in the .NET Framework start with index 0, or 0-based, so it's unnecessary to specify it in the new dimension parameter. Just use:
ReDim Preserve marr(count)
Dave Kreskowiak Microsoft MVP - Visual Basic