Results 1 to 3 of 3

Thread: Problems saving passwords in text files

  1. #1

    Thread Starter
    Lively Member brjames's Avatar
    Join Date
    Jan 2000
    Location
    Tenby, Wales, UK
    Posts
    121
    I am trying to have a password that the user enters before my program. I have already created a file called C:\password1.txt

    The problem is that when I let the user change their existing password and enter a new one, the program just stops running and no error messages come up. I then have to click on the stop button.

    Here is my code: (there's probably a stupid erroro in there somewhere but I can't find it!)Private Sub Command1_Click()

    Open "C:\password1.txt" For Input As #1
    Line Input #1, A$
    If txtOldpassword.Text = A$ Then

    'Close #1
    Open "C:\password1.txt" For Output As #1
    Print #1, txtNewpass.Text
    Close #1

    Load MainMenu
    MainMenu.Show
    Unload Changepassword

    Else
    MsgBox ("Wrong password entered")
    Close #1
    End If

    End Sub

    Can anyone help?

    Cheers

    brjames


  2. #2
    Junior Member
    Join Date
    Mar 2000
    Location
    london
    Posts
    31
    you could try putting the new password into a string and using that to write to the file eg.
    a$=newpassword.text
    print #1,a$
    also it looks like you have a ' before the first close #1 take it out and it should work
    D Stonebanks

  3. #3
    Junior Member
    Join Date
    Mar 2000
    Location
    london
    Posts
    31
    also try using
    input #1,a$
    not line input
    D Stonebanks

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