Results 1 to 6 of 6

Thread: Listview.....

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    2

    Listview.....

    i just wanna ask if i can add all the items(unlimited) in the listview??? aND IF I can store all the things i put in the listview? or can i connect the listview to database?? thnx guyz!!! ^_-

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Listview.....

    I don't know the limit for number of items in a listview but I'm sure it's very large. You can retrieve and store items from the listview in a database using ADO, or even a text file if you want to do that.

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Listview.....

    When you say "add all the items(unlimited)" what exactly did you have in mind? I just loaded listview with 1000000 items (one column only) and it almost hung my system and that was simple loop iterating long inetger. If you're planning on loading tens of thousands of items then performance will be absolute killer.

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Listview.....

    It took 41 seconds to load a listview with a million records using this code.

    VB Code:
    1. Option Explicit
    2. Private Declare Function LockWindowUpdate Lib "User32" (ByVal hwndLock As Long) As Long
    3. Private Declare Function GetTickCount Lib "kernel32" () As Long
    4.  
    5. Private Sub Form_Load()
    6.  
    7. Dim x As Long
    8. Dim clmX As ColumnHeader
    9. Dim itmX As ListItem
    10. Dim lngStart As Long
    11. Dim lngFinish As Long
    12.  
    13. ListView1.BorderStyle = ccFixedSingle ' Set BorderStyle property.
    14. ListView1.View = lvwReport ' Set View property to Report.
    15.  
    16. Set clmX = ListView1.ColumnHeaders.Add(, , "Col 1", 1000)
    17.  
    18. lngStart = GetTickCount()
    19.  
    20. LockWindowUpdate ListView1.hWnd
    21.    
    22. For x = 0 To 1000000
    23.     Set itmX = ListView1.ListItems.Add(, , CStr(x))
    24. Next
    25. LockWindowUpdate 0&
    26.  
    27. lngFinish = GetTickCount()
    28. Debug.Print CStr(lngFinish - lngStart)
    29.  
    30. End Sub

  5. #5

  6. #6
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Listview.....

    Quote Originally Posted by RiCe ^_-
    i just wanna ask if i can add all the items(unlimited) in the listview??? aND IF I can store all the things i put in the listview? or can i connect the listview to database?? thnx guyz!!! ^_-
    Unlimited? Of course every control has it's limitation though I think listview could accomodate a very large no. of rows and will suffice to your needs... You can't connect a listview to a database but you can populate it with data that comes from a database, Martinliss has cited an example...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

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