Microsoft KB Archive/74517

= FIX: Overflow Error If Print Long String to Form or Printer =

Article ID: 74517

Article Last Modified on 11/18/2003

-

APPLIES TO


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

-



This article was previously published under Q74517



SYMPTOMS
An &quot;Overflow&quot; error message may occur when you print a long string in Microsoft Visual Basic for Windows.

When a character is printed using the Print method, the CurrentX and CurrentY coordinates are also updated for the object being printed to. If the string being printed is long enough to cause the value of the CurrentX property to exceed 32,767 twips, an &quot;Overflow&quot; error will occur. This behavior is by design.

&quot;Overflow&quot; can be caused by printing a single long string or by repeatedly printing shorter strings that are appended onto the end of the last string -- using the Visual Basic semicolon operator.



STATUS
Microsoft has confirmed this to be a problem in Microsoft Visual Basic versions 1.0 and 2.0 for Windows. This problem was corrected in Microsoft Visual Basic version 3.0 for Windows.



Steps to Reproduce Problem
 Start Visual Basic or choose New Project from the File menu. Place a label control on Form1.  Add the following code to the Form_Click event: Sub Form_Click For index% = 1 to 1000 Print &quot;A&quot;; Label1.Caption = Str$(CurrentX) Next End Sub  From the Run menu, choose Start. Click Form1.

An &quot;Overflow&quot; error will occur. You can examine the label caption to see that the value of Form1.CurrentX plus the TextWidth of &quot;A&quot; exceeded 32767 at the time of the error.

Additional query words: buglist1.00 buglist2.00 fixlist3.00 2.00 3.00

Keywords: kbbug kbfix KB74517

-

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

© Microsoft Corporation. All rights reserved.