Microsoft KB Archive/167106

= BUG: Rich Text Box Control Does Not Word Wrap =

Article ID: 167106

Article Last Modified on 12/10/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Control Creation Edition
 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition

-



This article was previously published under Q167106



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
 Create a new Standard EXE in Visual Basic 5.0. Form1 is created by default. Press CTRL+T to bring up the Components dialog. Select the Microsoft Rich Text Box Control 5.0. Draw a Rich Text Box Control onto Form1.  Set the following properties for RichTextBox1: Multiline = True RightMargin = 0

</li> Run the project.</li> 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.</li></ol>

Keywords: kbbug KB167106

-

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

© Microsoft Corporation. All rights reserved.