|
-
Feb 11th, 2004, 05:46 PM
#1
Thread Starter
Member
now to make this faster?
Ok, I have a testfile with 40.000 lines
I want to add all of these in a control.
I tried Listview and it's very slow.. takes about 50 seconds to load
I did use the event listview1.beginupdate and .endupdate
so that speeds it up a little bit to 14 seconds , but still to slow..
Here is the source, and I hope someone can help me.. cause I see the newsreaders doing it within 1-2 seconds
Dim s As Array
Dim w As String
Dim f As String = "C:\newsgroups.txt"
Dim stream_reader As New IO.StreamReader(f)
Dim he As Long
Dim tmpImportProgress As Double
Dim splitlist(2) As String
Dim aas As String
Dim z As Long
Dim zz As Long
z = GetTotalRows()
he = z
z = z - 1
s = (Split(stream_reader.ReadToEnd, vbCrLf))
stream_reader.Close()
Dim c1, c2, c3 As String
Dim a() As String = s(0).Split(Chr(10))
ListView1.BeginUpdate()
Application.DoEvents()
For x = 1 To a.Length - 2
splitlist = a(x).Split("<PKA>")
c1 = splitlist(0)
c2 = Mid(splitlist(1), 5, Len(splitlist(1)) - 4)
c3 = Mid(splitlist(2), 5, Len(splitlist(2)) - 4)
Dim listItem1 As New ListViewItem(splitlist(0))
listItem1.SubItems.Add(c3)
listItem1.SubItems.Add(c2)
listItem1.SubItems.Add(c2 - c3)
fakeListView.Items.Add(listItem1)
ListView1.Items.Add(listItem1)
tmpImportProgress += (100 / he)
clsImportProgress = CInt(tmpImportProgress)
RaiseEvent ImportProgress()
Next
Application.DoEvents()
For zz = 0 To he - 1 '9
Dim listItem As New ListViewItem(fakeListView.Items(zz).SubItems(0).Text)
listItem.SubItems.Add(fakeListView.Items(zz).SubItems(1).Text)
listItem.SubItems.Add(fakeListView.Items(zz).SubItems(2).Text)
listItem.SubItems.Add(fakeListView.Items(zz).SubItems(2).Text - fakeListView.Items(zz).SubItems(1).Text)
ListView1.Items.Add(listItem)
Next
ListView1.EndUpdate()
and here is a part from the newsgroups.txt
basicly <PKA> is for seperating to different columns.
So
Newsgroup Endnumber Startnumber
24hoursupport.helpdesk<PKA>922050<PKA>739010
3b<PKA>5174<PKA>4224
3b.config<PKA>29105<PKA>27724
3b.misc<PKA>28002<PKA>26610
3b.tech<PKA>12728<PKA>11546
3b.test<PKA>95298<PKA>88012
Thanks so much
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|