PRB: DropDown Combo Box May Display Partial String
ID: Q89219
|
The information in this article applies to:
-
Microsoft Visual Basic Standard and Professional Editions for Windows, versions 2.0, 3.0
-
Microsoft Visual Basic programming system for Windows, version 1.0
-
Microsoft Windows versions 3.0, 3.1
SYMPTOMS
If the Visual Basic for Windows Combo Box Style is set to "0 - Dropdown
Combo," you may see only the rightmost portion (right-aligned string) of
the text displayed in the text box portion of the combo box at run time.
This problem only occurs if the combo box is too narrow to display the
entire string.
WORKAROUND
To work around the problem, set the combo box Style property to
"2 - Dropdown List" to change the Style property displays to the
left part of the string.
Another alternative is to design the combo box with a wider dimension
by increasing the width to greater than 1440 twips (the equivalent of
one inch). For example, if you set the Width property to 4320 twips,
the width increases to approximately three inches -- a size of combo
box that would hold the entire string in the example shown in the
More Information section below.
STATUS
This behavior is by design.
MORE INFORMATIONSteps to Demonstrate Behavior
- Start Visual Basic, or from the File menu, choose New Project (ALT,
F, N) if Visual Basic is already running. Form1 is created by default.
- Add a one-inch wide combo box (that is, the width is equal to 1440
twips by default for a combo box) to Form1.
- Double-click the form or press F7 to open the Form_Click event
procedure. Add the following code to the Form_Click event procedure:
Sub Form_Click ()
Combo1.AddItem "1234567890000000000" '** 10 zeros
End Sub
- Press F5 to run the example, or from the Run menu, choose Start.
- Click the form a couple of times.
- Select the down arrow on the combo box, and click one of the entries.
You should see the entry being placed in the text box portion of the
combo box, but instead the entry only displays zeros. The digits 1
through 9 are not displayed.
- If you change the Style property of the combo box to "2 - Dropdown
List," and try the example, the left-aligned string displays in the
combo box.
Additional query words:
2.00 3.00
Keywords :
Version :
Platform :
Issue type :
|