Results 1 to 3 of 3

Thread: List View API

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Posts
    2

    List View API

    Hello,

    Am having a table which consists of 37000 rows. In my VB application am using List View Control, to which am adding 37000 rows. The loading time it is taking around 1 to 2 min, but when i use the command listview1.clear then it is taking nearly 15 to 17 min, to clear the list view control.

    I had done this by using the windows common control service pack 3.0. After that to test i have changed the windows common control service pack 2.0., then for loading time it is taking maximum, but to clear the list view it is clearing with in seconds i.e. less than a one min.

    So suggest me how to over come this problem. Do we have any API control to add items in the list view control and clear the list view control.
    URS
    Vegesna

  2. #2
    jim mcnamara
    Guest
    That's interesting. VB documentation says the limit for items in a ListBox control is 32767 items. Not 37000. You should limit the query to return only 32767 rows.

    If you use LockWindowUpdate, it will definitely speed up both the .Clear method and the .AddItem method, by a factor of ten.

    Code:
    Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Long) As Long 
    
    dim i as long
    i = LockWindowUpdate List1.hWnd
    
    for x= 1 to many
        List1.AddItem stuff( x)
    next
    i= LockWindowUpdate False
    
    '   ................
    ' do stuff 
    ' 
    i = LockWindowUpdate List1.hWnd
    List1.Clear
    i= LockWindowUpdate False

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    jim mcnamara has a very good point. How are you getting 37,000 rows into a ListView control.

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