Microsoft KB Archive/184198

= PRB: SelHangingIndent Property of R RichTextBox Is Not Persistent =

Article ID: 184198

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q184198



SYMPTOMS
The SelHangingIndent property can be set to negative values to create format paragraphs in a RichTextBox control. The value of the SelHangingIndent property is reflected in the textRTF property of RichTextBox. However, when the textRTF property is saved in a variable or in a file and then restored, the SelHangingIndent property is set to 0 and the regular paragraph format is lost.



CAUSE
The Microsoft RichTextBox control internally uses the standard RichText DLL, Riched32.dll. This DLL does not persist the SelHangingIndent property. This behavior can be seen in Wordpad.exe as well, because Wordpad also uses this DLL.



RESOLUTION
Tabs and spaces can be inserted at the start of the text to create the same format.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
 Start a new project. Form1 is created by default. Add a RichTextBox and two CommandButtons to Form1.  Paste the following code in the General Declarations section of Form1: Dim s As String

Private Sub Command1_Click RichTextBox1.SelHangingIndent = -300 s = RichTextBox1.TextRTF End Sub

Private Sub Command2_Click RichTextBox1.TextRTF = s     End Sub

Private Sub Form_Load RichTextBox1.SelIndent = 1000 End Sub  Run the project. Add text to the control so one or more lines word wrap to the next line.</li> Click Command1 to change the SelHangingIndent and to save the textRTF in a variable.</li> Click Commmand2. Note that the hanging indent is no longer active.</li></ol>

Additional query words: save read kbVBp500 kbVBp600 kbctrl kbVBp kbdsd kbDSupport

Keywords: kbprb KB184198

-

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

© Microsoft Corporation. All rights reserved.