Results 1 to 3 of 3

Thread: Saving Username/Password to a txt file

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    70

    Saving Username/Password to a txt file

    Hello, I am creating a program that uses Usernames and Passwords and I have 5 of them so far in a listbox. How would I go about saving this to a .ini or .txt file? In the listbox they are stored as username:Password and I would like it to be like this in the .txt or .ini file. I do not know how to create the array to loop thru the listbox and save the log-ins. Any help would be appreciated.

    Thanks,
    nick

  2. #2
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016

    Re: Saving Username/Password to a txt file

    To save
    VB Code:
    1. Dim i As Integer, FF As Integer
    2.  
    3. FF = FreeFile
    4.  
    5.  Open "C:\UserPass.txt" For Output As #FF
    6.   For i = 0 To List1.ListCount - 1
    7.    Print #FF, List1.List(i)
    8.   Next i
    9.  Close #FF
    And to load
    VB Code:
    1. Dim FF As Integer, tmpString As String
    2.  
    3. FF = FreeFile
    4.  
    5.  Open "C:\UserPass.txt" For Input As #FF
    6.   Do While Not EOF(FF)
    7.    Line Input #FF, tmpString
    8.    List1.AddItem tmpString
    9.   Loop
    10.  Close #FF

    casey.

  3. #3

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