Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 323673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:03:10+00:00 2026-05-12T09:03:10+00:00

I have a VB6 application with a search screen. On the search, I have

  • 0

I have a VB6 application with a search screen. On the search, I have 9 combo boxes. Some of the combo boxes only have a couple items, but some have a couple hundred items. It takes a long time (couple of seconds) to populate the data.

Each combo box is configured the same: Sorted = False, Style = 2 – Dropdown List

3 of the combo boxes have less that 20 items.
1 has 130 items.
4 have approximately 250 items
1 has almost 700 items.

I fill all nine combo boxes with similar code.

While Not RS.EOF

    cmbX.List(i) = RS("Description")
    cmbX.ItemData(i) = RS("Id")

    i = i + 1

    RS.MoveNext
Wend

I tried setting Visible = False but it had no effect on performance.

Is there another way to fill the combo box that will perform better than my existing method?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:03:10+00:00Added an answer on May 12, 2026 at 9:03 am

    Here is something you can try. According to this post you can shave about 60% off your overhead by using a Windows API function to populate the combo box, instead of the usual AddItem method:

    Private Const CB_ERR As Long = -1
    Private Const CB_ADDSTRING As Long = &H143
    Private Const CB_RESETCONTENT As Long = &H14B
    Private Const CB_SETITEMDATA As Long = &H151
    
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _
    hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    
    Public Sub AddItem(cmb As ComboBox, Text As Variant, Optional ItemData As Long)
    
       Dim l As Long
       Dim s As String
    
       If VarType(Text) = vbString Then
          s = Text
       Else
          s = Trim$(Str$(Text))
       End If
    
       l = SendMessage(cmb.hwnd, CB_ADDSTRING, 0&, ByVal s)
       If l <> CB_ERR Then
          SendMessage cmb.hwnd, CB_SETITEMDATA, l, ByVal ItemData
       End If
    
    End Sub
    
    Public Sub Clear(cmb As ComboBox)
       SendMessage cmb.hwnd, CB_RESETCONTENT, 0, 0&
    End Sub
    

    You might be able to shave a little more off by omitting the function call, and just calling the API function directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have VB6 application , I want to put some good error handling finction
I have a VB6 application that still references some old VB5 libraries (dll, vbr,
I have a VB6 application which someone wrote, which does not work for only
I have a VB6 application that needs to update it's self. For this purpose,
I have a VB6 application implemented as an ActiveX exe. I also have a
I have a legacy VB6 application that was built using MSDE. As many client's
I have a legacy VB6 application that uploads file attachments to a database BLOB
I have a VB6 desktop application that is deployed on well over 1200 desktops.
I have a VB6's Application that is in production environment right now, this application
I have inherited a VB6/Access application that we have developed and sold for many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.