Results 1 to 11 of 11

Thread: textfile to streamreader to listview

Threaded View

  1. #1

    Thread Starter
    Addicted Member theonetrueace's Avatar
    Join Date
    Jan 2002
    Location
    South Alabama
    Posts
    196

    textfile to streamreader to listview

    k..i got a listview i need to load a text file into it.....
    text file looks like this...

    Username1
    Password1
    Username2
    Password2

    i got my save to file sub lookin like this...
    Code:
        Private Sub SaveList()
            Dim sTemp As String = Application.StartupPath.ToString & "\idlist.txt"
            Dim sTemp1 As String
            ' Loop through and save all items in list.
            If (LV_IDList.Items.Count > 0) Then
                Try
                    Dim i As Integer
                    ' Create a StreamWriter object to write to the file.
                    Dim writer As New IO.StreamWriter(sTemp, False)
                    ' Write the information to the file one line at a time.
                    i = 0
                    Do
                        If i < LV_IDList.Items.Count Then
                            sTemp1 = LV_IDList.Items(i).Text & vbNewLine & LV_IDList.Items(i).SubItems(1).Text
                            writer.WriteLine(sTemp1)
                            i = i + 1
                        Else
                            Exit Do
                        End If
                    Loop
                    ' Close the StreamWriter object.
                    writer.Close()
                Catch
                End Try
            End If
        End Sub
    now i need to know how to read the file line by line....then i want to add the usernames as an item with the password as the first subitem....

    thx in advance

    AcE
    Last edited by theonetrueace; Apr 25th, 2003 at 12:22 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width