TextHeight Can Cause "Overflow" Error if String Contains CRs

ID Number: Q76637

1.00

WINDOWS

buglist3.00 buglist3.00a

Summary:

You can receive an "Overflow" error when calling the Microsoft Visual

Basic TextHeight method if the string passed to TextHeight contains

carriage return plus linefeed characters, and the object performing

the method has a large font size.

The "Overflow" error occurs because of a problem with the Windows API

routine GetTextExtent, which Visual Basic is calling to determine the

text height of the string. Microsoft will consider correcting this

problem in a future version of Microsoft Windows.

This information applies to the Microsoft Visual Basic programming

system 1.0 for Windows.

More Information:

Steps to Reproduce Problem

--------------------------

1. Start Visual Basic, or from the File menu, choose New Project.

2. Double-click on Form1 to bring up a code window. Enter the

the following code in the Form_Click event procedure:

Sub Form_Click()

A$ = "A" + Chr$(13) + Chr$(10) + "B"

F = 1

Do

Fontsize = F

X = Textheight(A$)

F = F + 1

Loop

End Sub

3. Press F5 to execute the program and click on Form1. An "Overflow"

error will occur at approximately F = 731.

Additional reference words: 1.00