How to Redim an Array That Represents a Field Of a Structure?
Solution Available
John K.

Sep 26, 2011
55 Posts

How to redim an array that represents a field of a structure?

Hi there! I'm willing to redim an array of bytes that is a field of a structure with some other fields. But I can't! Let's say the structure is DiscStruct and I use the following command to redim the field abData[1]: ReDim DiscStruct.abData [20]. But no use! The compiler doesn't return any error but the array's dimension remains unchanged! How come? Can anyone please tell me where am I wrong?

DrATEasy (Ron Y.)
Mission Viejo, CA

Sep 26, 2011
288 Posts

Re: How to redim an array that represents a field of a structure?

Structure has a fixed size that cannot be changed (similar to C++). You can define the structure member/field as a variant type:

    vr : variant  ! will hold the array

stA: structA
al : long[1]

! initialize as array field with one element

! assign a value to the array
print  stA.vr[0]

! redim to 100 elements
redim al[100]
al=stA.vr ! preserve the values
stA.vr=al  ! will set the variant to hold 100 elements

Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]