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