50分求助!VB 设置密码登入,并且密码可以自行设置 (为避免浪费分,得到满意回答后,给50分!)

来源:百度知道 编辑:UC知道 时间:2024/05/05 06:37:39
VB 设置密码登入,并且密码可以自行设置(为避免浪费分,得到满意回答后,给50分!)

界面,有俩个text1(作用:输入密码)和text2(作用:输入密码)。一个按钮,如点击之后,text1和text2输入不一致则提示错误,要求重新输入,一致的话,点击按钮后进入我做的另一个界面。密码不是固定的!可以设定text的作用,就是设定密码。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%我需要不是此类源码,如下:
%
% Private Sub Command1_Click()
% If (Text1.Text = "470117358" And Text2.Text = "470117358") %Then
% MsgBox "登陆成功", vbOKOnly, "欢迎使用"
% Form2.Show 1
% Else
% MsgBox "密码不一致,请重新输入"
% End If
% End Sub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

期待高手的回答!!
谢谢下面的俩位的回答,我忘了说了,是不要连接数据库的。
%这个程序的功能应该和挂机锁的功能差不多,但是我不是做挂机锁
%
%
%
%
%
%
%
%
%
%
%
%
%
%

Dim PassWord As String
Dim strYorN As String
Private Sub Command1_Click()
Call SaveSetting(App.Title, Text1.Name, "text", Text1.Text)
Call SaveSetting(App.Title, Command1.Name, "Enabled", "False")
End Sub

Private Sub Command2_Click()
PassWord = GetSetting(App.Title, Text1.Name, "text")
If Text1.Text = PassWord Then
Form2.Show
Else
MsgBox "密码错误,请重新设置"
End If
End Sub

Private Sub Form_Load()
strYorN = GetSetting(App.Title, Command1.Name, "Enabled")
Command1.Enabled = strYN
Text1.PasswordChar = "*"
Text2.PasswordChar = "*"
Command1.Caption = "密码设置"
Command2.Caption = "进入系统"
End Sub

Private Sub Text2_LostFocus()
If Text2.Text = Text1.Text Then
Exit Sub
Else
MsgBox "两次输入的密码不一致"
Text1.SetFocus