• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

Combobox dropdown list doesn't go away

After I clear a combobox, and then select it, the dropdown list is the length of the last set of data in the list.  The dropdown image doesn't go away after clicking on the down arrow.  If I move my cursor to another window and back, it goes away.

Here is my code:
   'Load group combo box with group names
   gsSQL = "SELECT AVT_ClusterNo, AVT_Cluster FROM XrayAdvantage_Clusters "
   gsSQL = gsSQL & "WHERE AVT_MktNo = " & cboMkt.ItemData(cboMkt.ListIndex)
   gsSQL = gsSQL & "GROUP BY AVT_ClusterNO, AVT_Cluster "
   gsSQL = gsSQL & "ORDER BY AVT_Cluster"
   If rsTemp.State = adStateOpen Then rsTemp.Close
   rsTemp.Open gsSQL, cnXray, adOpenStatic, adLockReadOnly
   Do Until rsTemp.EOF
      cboGroup.AddItem rsTemp!AVT_Cluster
      cboGroup.ItemData(cboGroup.NewIndex) = rsTemp!AVT_ClusterNO
   Set rsTemp = Nothing

  • 4
  • 4
1 Solution
I'm trying to understand your question.  Please correct and clarify if I misunderstood.  Are there two questions here:

1.  "After I clear a combobox, and then select it, the dropdown list is the length of the last set of data in the list."

Are you saying here that when you clear and repopulate the combo box from a query data result set, that the visible element of the combo box that drops down stays the same length regardless of the number of elements in the list?  Do you have more than 8 items in the list?  That is normal.  I don't think you can change the number of rows that are displayed in a combo box on VB6.  

Try this example.  Start a new form, and put a combo box and a button on the form.  Paste this code in the form module.

Private Sub Command1_Click()

    Dim i As Integer
    Dim r As Integer
    r = CInt(Int(8 * Rnd(Time) + 1))
    For i = 1 To r
        Combo1.AddItem "Item " & Format(i, "00")
        Combo1.ItemData(Combo1.NewIndex) = i
    Next i
    MsgBox r & " items added to list."

End Sub

Private Sub Form_Load()
End Sub

Open in new window

Notice it will place a random number of elements in the combo box when you press the button.  After you press the button, click the combo box drop down button and look at the list.  It adjusts based on the number of items in the list.

Now, change the value 8 to something like 45, and run the program again.  Click the button to add items to the combo box again.  Anything over 8 items in the list will always show only a maximum of 8 entries in the list.

2. "The dropdown image doesn't go away after clicking on the down arrow."

This is puzzling, because I can't reproduce what you are describing.  Nothing I can do seems to keep the list under the drop down combo box visible.  Can you show a screenshot or further explanation to clarify what the
problem is.  Or maybe even upload a small sample project that demonstrates the problem you are describing.
jsaacsonAuthor Commented:
Here is what it looks like

(Sorry for the delay.)

Oh, I see.  The is a refresh issue.  Based on what I saw here, I tried to recreate the form to see if it behaves the way you demonstrated.  Can you try my sample (attached) and see if it behaves incorrectly for you.  It did not exhibit the problem you showed for me.  I'm wondering if there is something else on the form or something with the elements directly below the combo box that is causing this.

Try mine, and let me know what the two controls are directly below the combo - text or label, frame or box.

Try my sample, then, if you can take your form, strip out the code and use something like the code I have in mine to populate the combo boxes with dummy data, and see if it still behaves that way.  And possibly upload just that form so I can try it on my system.  I think it either has to be something with the controls, or code on the form.

This is VB6, right?  Not Access (There is a command in Access to pause screen refreshes that I could see causing this to happen.)  What about any 3rd party controls on the form? It looks like they are all standard controls, but I wanted to check that.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

jsaacsonAuthor Commented:
I don't see your sample.  
Sorry about that.  Here's the form file.  Can you upload a copy of your form without the code attached.
jsaacsonAuthor Commented:
I am going to close this issue, as the problem only occurs when I am testing the program from visual basic.  Once I create the executable module and run from that, the problem goes away.  Thus it isn't important enough to figure out why it is happening.

Thanks for your help
jsaacsonAuthor Commented:
The problem goes away when running in production.  While there may be a solution to the problem, it is not worth the effort to continue researching and testing solutions.  Therefore, I am dropping the issue.

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now