BUG: Rich Text Box Control Does Not Word Wrap

Last reviewed: June 2, 1997
Article ID: Q167106
The information in this article applies to:
  • Microsoft Visual Basic Control Creation, Learning, Professional, and Enterprise Editions for Windows, version 5.0

SYMPTOMS

Setting the Multiline property of a Rich Text Box control to True does not behave as expected. By setting Multiline to True, words should wrap when they are typed or displayed in a Rich Text Box control. However, they do not.

CAUSE

This behavior occurs only if the RightMargin property of the Rich Text Box control is set to 0. However, the Help file topic for the RightMargin property of the RichTextBox control incorrectly states the following:

   "The default for the RightMargin property is 0 and will cause the
   control to set text wrapping equal to the right-most part of the
   RichTextBox control so all text is viewable."

RESOLUTION

To work around this behavior, set the RightMargin property to a value greater than zero. To get the Multiline behavior to work as expected, set the RightMargin property equal to or slightly less than the Width property of the Rich Text Box control.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

This behavior occurs only with version 5.00.3714 of the Rich Text Box control that is shipped with Microsoft Visual Basic 5.0.

Steps to Reproduce Behavior

  1. Create a new Standard EXE in Visual Basic 5.0. Form1 is created by default.

  2. Press CTRL+T to bring up the Components dialog.

  3. Select the Microsoft Rich Text Box Control 5.0.

  4. Draw a Rich Text Box Control onto Form1.

  5. Set the following properties for RichTextBox1:

          Multiline = True
          RightMargin = 0
    

  6. Run the project.

  7. Type words into the Rich Text Box until the typed text reaches beyond the right hand margin of the control. Note that the text will not wrap to the next line but will continue off to the right.


Keywords : vb5all
Version : 5.0
Platform : WINDOWS
Issue type : kbbug


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: June 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.