04-28-2005, 06:11 PM
Hi 2 All
Is there a way to redim a shared array of types in a Sub?
In the following code, it looks like the Change Sub creates a new local array and then when return to main code the values changed there are lost; Is there a way to to this or I must use pointers?
Greets
Tio Bit
Is there a way to redim a shared array of types in a Sub?
In the following code, it looks like the Change Sub creates a new local array and then when return to main code the values changed there are lost; Is there a way to to this or I must use pointers?
Greets
Tio Bit
Code:
'$DYNAMIC
OPTION EXPLICIT
TYPE TModel
Code AS INTEGER
Array(0 TO 1) AS INTEGER
END TYPE
DECLARE SUB Change
DIM SHARED Model AS TModel
Model.Array( 0 ) = 5
Model.Array( 1 ) = 10
PRINT Model.Array( 0 )
PRINT Model.Array( 1 )
Change
PRINT
PRINT Model.Array( 0 )
PRINT Model.Array( 1 )
PRINT Model.Array( 2 )
END
'--------------------------
SUB Change
'--------------------------
REDIM Model.Array(0 TO 2) AS INTEGER
Model.Array( 0 ) = 15
Model.Array( 1 ) = 20
Model.Array( 2 ) = 25
END SUB