To add to an exiting flat file you have to open it for Append.
Code:
Dim intFile As Integer
intFile = FreeFile()
Open "C:\MyDir\MyFile.txt" For Append As intFile
Print #intFile, strUser; "," ; strPassword
Close intFile
Will add the contents of strUser and strPassword (comma separated) to the end of C:\MyDir\MyFile.txt. If the file doesn't exist it will be created.
Getting the data from the ListView will depend on which 'columns' the Username and Password are in
e.g
Code:
strUser = lv.ListItems(0).Text
strPassword = lv.ListItems(0).ListSubItems(1).Text
would assign whatever is in the first row and first 'column' of the ListView (lv) to strUser and whatever is in the second 'column' of the same row to strPassword.