Link to home
Start Free TrialLog in
Avatar of XK8ER
XK8ERFlag for United States of America

asked on

vb.net - load large txt data into listview

hello there,
I have this code to load data into a listview but since its about 50,000 records its taking a about 8 to 15 seconds to load..
I was wondering if there is a way to load these items faster?
Public Sub LoadNames(ByVal mPath As String, ByVal LVW As ListView)
        Dim lvi As ListViewItem, line As String
        If System.IO.File.Exists(mPath) Then
            Using sr As New System.IO.StreamReader(mPath)
                While Not sr.EndOfStream
                    line = sr.ReadLine()
                    If line.Length > 0 Then
                        lvi = LVW.Items.Add(line)
                    End If
                End While
            End Using
        End If
    End Sub

Open in new window

Avatar of Kamaraj Subramanian
Kamaraj Subramanian
Flag of Singapore image

Avatar of XK8ER

ASKER

i think you are in the wrong section
Avatar of Howard Cantrell
How large are the records per row?
Why or what are you  going to do with the records?
May be better to break down into sections.
Avatar of XK8ER

ASKER

I just want to import the records into a listview.. samples here

Daniel
Salmon
Bob
Roby
Lenny
ASKER CERTIFIED SOLUTION
Avatar of Howard Cantrell
Howard Cantrell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial