Hi all,
i am writing a program in vb6. i need to change the login user name and the password. I did it. but the problem is when i run the program again the changes are not saved. the code is as follows. pleas help me as wht is wrong there. I need to save the changed user name and password and save them in two variables and take them as the user name and the password.
Dim x As String
Dim y As String
Private Sub cmdbackto_Click()
frmpwun.Visible = False
End Sub
Private Sub cmdok_Click()
If (txtun.Text = x) Then
If (txtpw.Text = y) Then
Unload Me
Load MainForm
MainForm.Visible = True
Else
msg = MsgBox("Invalid Password", vbOKOnly + vbCritical, "Authentication")
txtpw.SetFocus
txtpw.Text = ""
End If
Else
msg = MsgBox("Invalid User name", vbOKOnly + vbCritical, "Authentication")
txtun.SetFocus
txtun.Text = ""
txtpw.Text = ""
End If
End Sub
Private Sub cmdpwun_Click()
If (txtun.Text <> x) Then
msg = MsgBox("Please enter the correct user name", vbExclamation, "User Name")
Else
If (txtpw.Text <> y) Then
msg = MsgBox("Please enter the correct password ", vbExclamation, "Password")
Else
frmpwun.Visible = True
End If
End If
End Sub
Private Sub cmgchange_Click()
If (txtunchange.Text = "") Then
msg = MsgBox("Please enter the new user name", vbExclamation, "User Name")
Else
If (txtpwchange.Text = "") Then
msg = MsgBox("Please enter the new password ", vbExclamation, "Bay")
Else
msg = MsgBox("Do you want to save the changes", vbExclamation + vbOKCancel, "Edit Authentication")
If (msg = vbOK) Then
x = txtunchange.Text
y = txtpwchange.Text
msg = MsgBox("Modifications are successfully saved ", vbExclamation, "Authentication")
txtunchange.Text = ""
txtpwchange.Text = ""
End If
End If
End If
End Sub
Private Sub Form_Load()
frmpwun.Visible = False
txtun.Text = x
txtunchange.Text = x
End Sub
Private Sub txtpw_Change()
'cmdok.SetFocus
End Sub