IronRazer, on 03 March 2013 - 04:32 PM, said:
Private Sub btnPassword_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPassword.Click
If txtPassword.Text = "Locked" Then
MsgBox("You must unlock the safe before trying to change the Password", MsgBoxStyle.Information)
Else
Password = InputBox("Set a Password")
If password.Length <= 5 Then
MsgBox("Must be longer than 5 characters")
Else
If password <> "" Then txtPassword.Text = "Locked"
End If
End If
End Sub
Your code worked!!!! Thanks a lot! The only problem I am having now is even if the user doesnt enter 5 characters and clicks ok the status still changes to locked.. iv amended the code you posted because it wouldnt let me use the else twice for some reason.
Private Sub btnPassword_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPassword.Click
If txtPassword.Text = "Locked" Then
MsgBox("You must unlock the safe before trying to change the Password", MsgBoxStyle.Information)
Else
Password = InputBox("Set a Password")
If password.Length <= 5 Then
MsgBox("Must be longer than 5 characters")
If password <=5> "" Then txtPassword.Text = "Locked"
End If
End Sub
As you can see from the above code the else has been removed because it will not let me have it. So then i tried <=5>, it works but then closes the program and brings up an error msg.
I know if that else was there it maybe would work but it does not let me put it there, brings a squiggly line under it.
thanks

New Topic/Question
Reply




MultiQuote







|