Undocumented Error: Too many local strings in Sub/Function (94831)



The information in this article applies to:

  • Microsoft Visual Basic for MS-DOS
  • Microsoft Basic Professional Development System for MS-DOS 7.0
  • Microsoft Basic Professional Development System for MS-DOS 7.1

This article was previously published under Q94831

SYMPTOMS

In Visual Basic for MS-DOS, the following BC.EXE compiler error can occur when a program has over 255 variable-length strings allocated in a procedure:
Too many local strings in Sub/Function
This includes Dim statements as well as compiler-generated local temporary variables. The same limit applies to the Basic Professional Development System when compiling for far strings (BC /Fs option), but no error occurs. This limit does not apply to the VBDOS.EXE and QBX.EXE interpreter environments.

WORKAROUND

To work around the problem, reduce the number of local strings in the procedure.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft Basic Professional Development System (PDS) for MS-DOS, version 7.1. This problem was corrected in Microsoft Visual Basic version 1.0 for MS-DOS.

MORE INFORMATION

The following program demonstrates this limit by declaring 300 variable- length string variables.
   Sub s
      Dim a1$
      Dim a2$
      ...
      Dim a300$
   End Sub
				


This program gives the error "Too many local strings in Sub/Function" when compiled in Visual Basic for MS-DOS, but it runs without an error message when compiled in the Basic Professional Development System. However, in the Basic Professional Development System if you use more than 255 variable-length strings, the strings may become corrupted.

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB94831