Microsoft KB Archive/120523

= BUG: Multiline Text Box Incorrectly Displays Large Text =

Article ID: 120523

Article Last Modified on 12/9/2003

-

APPLIES TO


 * Microsoft Visual Basic 2.0 Standard Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 2.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition

-



This article was previously published under Q120523



SYMPTOMS
A MultiLine Text Box control with only a vertical scroll bar may incorrectly display large strings that do not contain spaces or line feed characters. The control will potentially display an incorrect string, no string at all, or modify the visible font without affecting the control's font property.



STATUS
Microsoft has confirmed this to be a problem with the Windows Text Box (Edit) control. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



WORKAROUND
To workaround this problem, set the ScrollBars property of the Text box to:

'1 - Horizontal' or '3 - Both'



Steps to Reproduce Behavior
The following test application will reproduce the problems described above. Variations in FontName and FontSize will produce different results.

 Start a new project in Visual Basic. Form1 is created by default. Add a Text Box (Text1) and three Command Buttons (Command1, Command2, and Command3) to Form1. Set the Multiline property of Text1 to True and set the ScrollBars property to 2 - Vertical.  Add the following code to the load event of Form1: Sub Form_Load Text1.Left = 100 Text1.Top = 100 Text1.Width = 4000 Text1.Height = 1600 Command1.Left = 4500 Command1.Top = 100 Command2.Left = 4500 Command2.Top = Command1.Top + Command1.Height + 25 Command3.Left = 4500 Command3.Top = Command2.Top + Command2.Height + 25 End Sub   Add the following code to the click event of Command1: Sub Command1_Click Dim A As String Dim B As String

'A single '1' will appear in the Text 'box and the Font will not be bold although 'the property is set to True

Text1.Text = "" Text1.FontName = "MS Sans Serif" Text1.FontBold = True

A$ = String(4096, "1") B$ = String(4096, "2")

A$ = A$ & " " & B$     Text1.Text = A$   End Sub   Add the following code to the click event of Command2: Sub Command2_Click Dim A As String Dim B As String

'No text will appear in the Text1

Text1.Text = "" Text1.FontName = "MS Sans Serif" Text1.FontBold = True

A$ = String(4096, "1") B$ = String(4096, "2")

A$ = A$ & B$     Text1.Text = A$   End Sub </li>  Add the following code to the click event of Command3: Sub Command3_Click Dim A As String Dim B As String

'A blank line will appear followed by the 'Y's

Text1.Text = "" Text1.FontName = "MS Sans Serif" Text1.FontBold = True

A$ = String(4096, "X") B$ = String(4096, "Y")

A$ = A$ & B$     Text1.Text = A$   End Sub </li> Save the project and run. Click each of the command buttons to see the following results:

<ul> Command1: A single 1 will appear in the text box and the font will not be bold.</li> Command2: No text will appear in the text box.</li> Command3: A single blank row or row of Xs followed by Ys will be visible in the text box.</li></ul> </li></ol>

Additional query words: 2.00 3.00 buglist2.00 buglist3.00

Keywords: kbbug KB120523

-

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

© Microsoft Corporation. All rights reserved.