I'm really just sort of brainstorming here, but I'm at a point for the second time in my little project where I wouldn't mind some aliasing in VB6.

(Sure, I know I could wrap things in classes, and just use additional references, but that's not how I'm set up.)

Here's what I've got. Basically, I've got a complex UDT with several dynamic arrays as sub-elements. There are certain places where a series of option buttons specify which sub-element-array I'm working on.

(Yeah, I could set things up as an option button control array, and use the control indexes too (maybe even defining an enumeration that outlines the indexes), but I'm just not set up that way either.)

Rather than have to set up Select Case statements for several things that may change one of these sub-element-arrays, I'm thinking of doing some temporary aliasing (and doing it anytime the option buttons are clicked).

To do this, I'd just use a bit of GetMem4 and VarPtr. I'd also save the original VarPtr for the temp-alias-variable, and be sure and put it back when it went out of scope. Also, the complex-UDT is in a BAS module and completely global, so no fear of it going out of scope.

Basically, in other words, I want to alias a dynamic array. For the immediate situation, I know it'll be dimensioned.

------

I'll be sure and work out an example before I actually start doing it.

However, I'm just wondering if there are any potholes I'm overlooking.

Thanks,
Elroy