|
-
Feb 5th, 2004, 01:08 AM
#1
Thread Starter
Member
Reading Textfile into Listbox is soooo slow
Hi,
I am trying to read a Textfile with 40.000 lines into a listbox
so I am reading each line and add it to the listbox,
but that takes about 15-20 seconds... way to slow
Isn't there a faster way to do it? Cause I found a routine
that only takes 2 seconds to read it into a array, but putting it into
a listbox takes still 15-20 seconds
OK, I have this now and it reads it very fast into s(0)
but still adding to the listviewer takes forever.
Dim s As Array
Dim w As String
Dim f As String = "C:\newsgroups.txt"
Dim stream_reader As New IO.StreamReader(f)
s = (Split(stream_reader.ReadToEnd, vbCrLf))
stream_reader.Close()
' MsgBox("done") This takes only 1 second and
' all the data is in s(0)
Dim a() As String = s(0).Split(Chr(10))
For x = 1 To a.Length - 1
ListView1.Items.Add(a(x))
Next
What am I missing here?
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
|