vb6 - load file into listview without split

hello there,
I have this code that will load a text file into a listview but if the text file has name1:lastname1 it will split it!!
now I only have name name1 so I dont need the split..

this is the code I am using

Public Sub LoadFile(mPath As String, LVW As ListView)
    LVW.ListItems.Clear
    Set fso = New FileSystemObject
    Set TS = fso.OpenTextFile(mPath, ForReading, False)
    While Not TS.AtEndOfStream
      tabLine = Split(TS.ReadLine, ":")
          Set lItem = LVW.ListItems.Add(, , tabLine(0))
          lItem.ListSubItems.Add , , tabLine(1)
    Wend
    TS.Close
    Set TS = Nothing
    Set fso = Nothing
End Sub
SabrinAsked:
Who is Participating?
 
Jorge PaulinoIT Pro/DeveloperCommented:
Change it to this:

Public Sub LoadFile(mPath As String, LVW As ListView)
    LVW.ListItems.Clear
    Set fso = New FileSystemObject
    Set TS = fso.OpenTextFile(mPath, ForReading, False)
    While Not TS.AtEndOfStream
          Set lItem = LVW.ListItems.Add(, , TS.ReadLine)
    Wend
    TS.Close
    Set TS = Nothing
    Set fso = Nothing
End Sub

You also need to delete the second column of the listview
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.