Results 1 to 2 of 2

Thread: listview

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2013
    Posts
    22

    listview

    hello m in vb6
    i have a username and passwords loaded in listview and i wnana save it in txt file in form of usernameassword
    and i dont want to delete previous data of txt file just adding data in txtx file

  2. #2
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: listview

    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.

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