form1中
Public Names As String
Public Pass As String
Private Sub Command1_Click()
If Text1.Text = GetSetting("username", "save", "usernames") Then
If Text2.Text = GetSetting("username", "save", "password") Then
MsgBox "登陆成功"
Else
MsgBox "请输入正确的密码"
End If
Else
MsgBox "请输入正确的用户名"
End If
End Sub
Private Sub Command2_Click()
Names = Text1.Text
Pass = Text2.Text
SaveSetting "username", "save", "usernames", Names
SaveSetting "username", "save", "password", Pass
MsgBox "注册成功!"
End Sub
Private Sub Command3_Click()
Form2.Show
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Command1.Caption = "登陆"
Command2.Caption = "注册"
Command3.Caption = "修改密码"
End Sub
form2中
Private Sub Command1_Click()
If Text1.Text = GetSetting("username", "save", "password") Then
If Text2.Text = Text3.Text Then
Names = Text2.Text
SaveSetting "username", "save", "password", Names
MsgBox "修改密码成功"
Me.Hide
Else
MsgBox "两次输入的密码不一致"
End If
Else
MsgBox "旧密码输入不正确"
End If
End Sub
其实就是update数据库中的密码字段