FIX: Edit Replace All Has Different Limit Than Specified

Last reviewed: October 30, 1997
Article ID: Q113330
3.00 WINDOWS kbenv kbbuglist

The information in this article applies to:

- Microsoft Visual Basic programming system for Windows, version 3.0

SYMPTOMS

Performing an Edit Replace All on a long line of code in the Visual Basic Environment may generate this error message:

   One or more replacements too long and not made.

CAUSE

The Visual Basic for Windows environment limits the length of individual lines of code to 1023 characters. No line longer than this may be input. However, if you choose Edit Replace from the Visual Basic menu with the Replace All button selected, the environment erroneously limits the total line length to 254 characters.

WORKAROUND

To create a line longer than 254 characters, do it in separate lines and then concatenate the lines together by deleting the carriage return between the lines. A better solution would be to break up the single long line into multiple shorter lines. For additional information, please see the following article in the Microsoft Knowledge Base:

ARTICLE-ID: Q94696

TITLE     : How to Break Long Statements into Multiple Lines

STATUS

Microsoft has confirmed this to be a bug in the products listed at the beginning of this article. This problem has been corrected in Visual Basic version 4.0.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start a new project in Visual Basic. Form1 is created by default.

  2. Add the following code to the Form_Load event:

       Sub Form_Load ()
          Dim S As String
          ' Enter the following four lines as one, single line:
          S = "This is a test.This is a test.This is a test.This is a test.
          This is a test.This is a test.This is a test.This is a test.
          This is a test.This is a test.This is a test.This is a test.
          This is a test.This is a test.This is a test.This is a test.This xx"
          ' The previous string's quoted text is 247 characters in length.
          ' The total line length is 254 characters.
       End Sub
    
    

  3. Choose replace-all from the edit menu, and choose to change 'xx' to
       'xxx' to generate the following error message:
    
          One or more replacements too long and not made.
    
       The help text on this error message indicates that the replace
       operation has reached a 1023 character maximum:
    
       "A replace operation has attempted to create a line of code longer
       than the 1023-character maximum allowed. Those replacements where the
       resulting line is less than 1023 characters were completed."
    
       This is not true. The line length has not exceeded 1023 characters.
    


Additional reference words: buglist3.00 3.00 fixlist4.00
KBCategory: kbenv kbbuglist
KBSubcategory: EnvtDes
Keywords : EnvtDes kbbuglist kbenv
Version : 3.00
Platform : WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.