Microsoft KB Archive/50638

= &quot;Subscript Out Of Range&quot; If REDIM Long Integer Array in SUB =

Article ID: 50638

Article Last Modified on 11/21/2006



This article was previously published under Q50638



SYMPTOMS
REDIMing (redimensioning with REDIM) a dynamic long integer array that was passed to a SUBprogram generates a &quot;Subscript Out Of Range&quot; error at run time.



STATUS
Microsoft has confirmed this to be a bug in Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50 for MS-DOS and in Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2 (buglist6.00, buglist6.00b). This problem was corrected in Microsoft Basic PDS Version 7.00 (fixlist7.00).



MORE INFORMATION
The &quot;Subscript Out Of Range&quot; occurs whether the SUBprogram is compiled as part of the main program or it is compiled in a separate module.

You can work around this problem by using an array type other than long integer, or by passing the array through a COMMON SHARED block.

The following code demonstrates the problem passing a dynamic array of long integers to a SUBprogram and REDIMing it in the SUBprogram. REM $DYNAMIC DIM arrayb&(50) CALL Test(arrayb&) END

SUB Test(arrayc&) REDIM arrayc&(100) END SUB

Additional query words: QuickBas BasicCom buglist4.00 buglist4.00b buglist4.50 B_BasicCom SR# S891016-81

Keywords: KB50638

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.