ID Number: Q84546
1.00
WINDOWS
buglist1.00
Summary:
When you activate the drop-down portion of a Visual Basic combo box by
using its access key (ALT+DOWN ARROW) and add items while it is down,
a painting problem will occur. When the drop-down portion of the combo
box is pulled up, the added items are not removed from the display.
The added items are still visible, but they cannot be selected or
accessed in any way.
Microsoft has confirmed this to be a problem in Microsoft Visual Basic
programming system version 1.0 for Windows. We are researching this
problem and will post new information here as it becomes available.
More Information:
The combo box with the Style property set to 0 or 2 allows you to
display a drop-down list of choices for the user. A Style of 0
(Dropdown combo) allows the user to edit the entry after it has been
selected. A Style of 2 (Dropdown list) prevents the user from
modifying a selection.
If the drop-down portion of the combo box has been dropped by using the
access key sequence (ALT+DOWN ARROW), and the AddItem method is used
to add new items to the combo box, the new items will not be removed
from the display when it is pulled back up.
You should refrain from adding items to a combo box while the
drop-down portion is down. If you absolutely cannot avoid doing this,
then use the Refresh method after each AddItem method is executed.
Steps to Reproduce Problem
--------------------------
1. Run Visual Basic, or from the File menu, choose New Project (ALT,
F, N) if Visual Basic is already running. Form1 is created by
default.
2. Draw a combo box on Form1.
3. Add the following code to the combo box KeyPress event:
If KeyAscii = 13 Then
Combo1.AddItem Combo1.Text
End If
4. Press F5 to run the program. After your program has started
execution, press the combo box access key (ALT+DOWN ARROW).
5. Press ENTER several times.
6. Click on the form anywhere outside the combo box to lift the
drop-down portion of the combo box.
7. Notice that most of the image of the drop-down portion remains
visible.
Workaround
----------
To avoid this problem, replace the code from step 3 above with the
following:
If KeyAscii = 13 Then
Combo1.AddItem Combo1.Text
Combo1.Refresh
End If
Notice that the combo box is now painted properly.
Additional reference words: 1.00