Convert 1D Arrays to 2D Arrays and Back
Category:
Lists, Collections and ArraysType:
SnippetsDifficulty:
AdvancedAuthor:
neophileVersion Compatibility: Visual Basic 6
More information:
Here's another demonstration of the extremely useful CopyMemory() API call, a.k.a. RtlMoveMemory. I've used Byte arrays in this example, but it should work for any array with elements of a fixed length (i.e., since strings vary in length, this is probably not a good idea unless you write a new procedure to handle them explicitly.) Also, this can be adapted to deal with 3+ dimensions as well.
Instructions: Copy the declarations and code below and paste directly into your VB project.
Declarations: