:wave: 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!!! ^_-
Printable View
:wave: 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!!! ^_-
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.
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.
It took 41 seconds to load a listview with a million records using this code.
VB Code:
Option Explicit Private Declare Function LockWindowUpdate Lib "User32" (ByVal hwndLock As Long) As Long Private Declare Function GetTickCount Lib "kernel32" () As Long Private Sub Form_Load() Dim x As Long Dim clmX As ColumnHeader Dim itmX As ListItem Dim lngStart As Long Dim lngFinish As Long ListView1.BorderStyle = ccFixedSingle ' Set BorderStyle property. ListView1.View = lvwReport ' Set View property to Report. Set clmX = ListView1.ColumnHeaders.Add(, , "Col 1", 1000) lngStart = GetTickCount() LockWindowUpdate ListView1.hWnd For x = 0 To 1000000 Set itmX = ListView1.ListItems.Add(, , CStr(x)) Next LockWindowUpdate 0& lngFinish = GetTickCount() Debug.Print CStr(lngFinish - lngStart) End Sub
I did pretty much same thing Martin (except for the tickcount) and it probably took about the same time. Scrolling to last item (manually) was what almost hung my system...
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...Quote:
Originally Posted by RiCe ^_-