求编写一个vb小程序
先是输入原密码与已知数据源里的密码相比较是否相同再输入新密码并再次确认按确认修改之后将更改后的密码重新写入数据源里,万分感谢!...
先是输入原密码 与已知数据源里的密码相比较是否相同 再输入新密码 并再次确认 按确认修改之后将更改后的密码重新写入数据源里,万分感谢!
展开
1个回答
展开全部
添加一1个label,一个command,一个text即可,可循环修改密码
Dim a As String
Private Sub Command1_Click()
If Command1.Caption = "确认" Then
If Text1 = a Then
Call nex
Else
MsgBox "密码错误!", vbExclamation, "信息"
Text1 = ""
Text1.SetFocus
End If
ElseIf Command1.Caption = "修改" Then
Call xg
End If
End Sub
Sub nex()
Label1.Caption = "新密码:"
Text1.Text = ""
Text1.SetFocus
Command1.Caption = "修改"
End Sub
Private Sub Form_Load()
Me.Caption = "密码修改"
Text1 = ""
Text1.PasswordChar = "*"
Text1.ToolTipText = "默认密码:admin"
Label1.Caption = "原密码:"
Command1.Caption = "确认"
Call mi
End Sub
Sub mi()
If Dir(App.Path + "\mm") <> "" Then
Open App.Path + "\mm" For Input As #1
Input #1, a
Close #1
End If
If a = "" Then a = "admin"
End Sub
Sub xg()
Open App.Path + "\mm" For Output As #1
Print #1, Text1.Text
Close #1
a = Text1
MsgBox "密码修改成功!", vbInformation, "提示"
Text1 = ""
Text1.SetFocus
Command1.Caption = "确认"
Label1.Caption = "原密码:"
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询