BUG: Multiline Text Box Incorrectly Displays Large Text
ID: Q120523
|
The information in this article applies to:
-
Microsoft Visual Basic Standard and Professional Editions for Windows, versions 2.0, 3.0
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'
MORE INFORMATION
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
- 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
- Save the project and run. Click each of the command buttons to see
the following results:
- Command1: A single 1 will appear in the text box and the font will
not be bold.
- Command2: No text will appear in the text box.
- Command3: A single blank row or row of Xs followed by Ys will be
visible in the text box.
Additional query words:
2.00 3.00 buglist2.00 buglist3.00
Keywords :
Version : WINDOWS:2.0,3.0
Platform : WINDOWS
Issue type :