Results 1 to 11 of 11

Thread: [RESOLVED] Write to the SECOND line in a text file?

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    97

    Resolved [RESOLVED] Write to the SECOND line in a text file?

    Hello, I'm kind of troubled by this. How do I write to the second line of the text file? I'm using this code, to add encrypted text (in hex) to line one, and read it and validate it. I need to know how to add it to line 2, 3, 4, ect. Thank you for your help.

    VB Code:
    1. Sub addpw()
    2.  Dim ff%, i%
    3.  ReDim user(0)
    4.  ReDim pass(0)
    5.  index = 0
    6.  user(0) = InputBox("Enter User Name")
    7.  pass(0) = InputBox("Enter Password")
    8.  maxindex = 1
    9.  ff = FreeFile
    10.  Open (App.Path & "\login.txt") For Output As #ff
    11.  For i = 0 To maxindex - 1
    12.  Print #ff, StrToHex(user(i)) & " | " & StrToHex(pass(i))
    13.  Next i
    14.  Close #ff

    And I would call it to add the text by doing so:
    VB Code:
    1. Private Sub Form_Load()
    2. Call addpw
    3. user(0) = "Username"
    4. pass(0) = "Password"
    5. End Sub

    The bottom calls the top code, to add "Username" and "Password" encrypted in hex, on the first line of a text file. I need to be able to add it to the second line so I could do something like:
    VB Code:
    1. Form_Load()
    2. Call addpw
    3. user(0) = "Username"
    4. pass(0) = "Password"
    5. user(1) = "Username1"
    6. pass(1) = "Password1"
    7. user(2) = "Username2"
    8. pass(2) = "Password2"
    9. End Sub

    I think you get the point, thanks alot guys

    Also, once I have that done, how would I get it to check not only the first line, but the second one too, to validate it.
    Last edited by Echo{tWe}; Jun 11th, 2005 at 09:12 PM.

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