Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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)

If x > 20 Then Application.DoEvents()

 

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...