List Boxes Can Shrink When a Form Is Saved in Text Format
ID: Q141940
|
The information in this article applies to:
-
Microsoft Visual Basic Standard and Professional Editions for Windows, version 3.0
SYMPTOMS
Every time a project is run, a list box appears with a smaller height than
when the form was previously saved. The behavior seems to depend on whether
the form was saved in text format or binary, and the font used in the list
box. The list box does not grow any smaller once an executable is made.
The same problem described above can also occur for a file list box.
STATUS
This problem was fixed in both 16- and 32-bit versions of Visual Basic 4.0
(where all forms are saved only in a text format).
MORE INFORMATION
The problem described above occurs under certain circumstances. First, the
height of the list box shrinks after the form has been saved in text
format. (To save a form in text format, highlight the form in the project
window and on the File menu, click Save File As, with the Save As Text
check box selected.) If the form is saved consistently in the Binary
format, then the problem is not reproducible.
Secondly, the problem seems to only occur for certain fonts in the list
box. MS Sans Serif and Truetype fonts such as Arial are font choices where
the problem does not occur. Small Fonts and Courier are examples of fonts
in the list box where the problem does occur.
RESOLUTION
The following are three possible workarounds:
Steps to Reproduce the Problem
- Start a new Visual Basic project. Form1 appears by default.
- Place a list box on the form (it will be called List1 by default) and
set the height property of the list box to 6630 twips (or a suitable
high value).
- In the property window, set the FontName for the list box to Small
Fonts. Also, type in a size of 24 for the font (the problem occurs for
all sizes of the font, but is most easily seen for larger sizes).
- In the Activate event for the form, place the following line of code:
Debug.Print List1.Height
- Run the program by pressing the F5 key. Notice that the Debug window
correctly shows the original height of the list box. Stop the program.
- Save Form1 in a text format, that is, on the File menu, click Save File
As, and check the Save As Text check box.
- Run the program by pressing the F5 key. Notice that the debug window
still shows the original height of the list box. Stop the program.
- Save Form1 once again in text format--when Visual Basic asks if you
want to replace Form1, click Yes.
- Run the program again. Now the Debug window shows that the list box
height has decreased to 6030 twips.
After each successive save of the form in text format, the list box height
will decrease every time the project is run. However, the problem only
surfaces after the second save of the form in text format.
Additional query words:
kbVBp300bug kbVBp400bug kbVBp kbdsd kbDSupport kbControl
Keywords : kbGrpVB
Version : WINDOWS:3.0
Platform : WINDOWS
Issue type : kbbug