Results 1 to 4 of 4

Thread: ComboBox and method to a very speed loading of the data

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    ComboBox and method to a very speed loading of the data

    Hi All

    Like in a title. For the load e.g. 2000 records

    Someone know?

    Thanks in advance
    I know, I know, my English is bad, sorry .....

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: ComboBox and method to a very speed loading of the data

    VB Code:
    1. ' in a module
    2. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    3.     (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    4.  
    5. Private Const CB_INITSTORAGE = &H161
    6.  
    7. Public Sub ComboInitStorage(ByRef ComboBox As Object, ByVal Items As Long, ByVal ItemSizeEstimate As Long)
    8.     SendMessage ComboBox.hwnd, CB_INITSTORAGE, Items, ByVal (Items * ItemSizeEstimate)
    9. End Sub

    Example:
    VB Code:
    1. Private Sub Command1_Click()
    2.     ' init space for 2000 items reserving 50 bytes per item
    3.     ComboInitStorage Combo1, 2000, 50
    4.     ' then add code to fill the combobox...
    5. End Sub
    Last edited by Merri; Dec 15th, 2006 at 08:08 AM.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    Re: ComboBox and method to a very speed loading of the data

    Thanks Merri, unfortunatelly it not help me
    It’s still slowly.
    I know, I know, my English is bad, sorry .....

  4. #4
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: ComboBox and method to a very speed loading of the data

    Have you also tried setting Visible = False while you're loading the data and then True once you're done?

    Is the code you use to add the items very straightforward and simple or does it have more complexity than just a simple add within a loop?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width