📄 frmsearchform.frm
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form frmSearchForm
BorderStyle = 3 'Fixed Dialog
Caption = "储户信息查询"
ClientHeight = 2745
ClientLeft = 45
ClientTop = 330
ClientWidth = 7185
Icon = "frmSearchForm.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2745
ScaleWidth = 7185
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Height = 2655
Index = 0
Left = 100
TabIndex = 0
Top = 0
Width = 6975
Begin VB.CommandButton Command3
Caption = "关闭窗口(&C)"
Height = 375
Left = 5640
TabIndex = 15
Top = 960
Width = 1215
End
Begin VB.CommandButton CmdChangePwd
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
Caption = "更改密码(&G)"
Height = 375
Left = 5640
TabIndex = 14
Top = 600
Width = 1215
End
Begin VB.CommandButton CmdSearch
Appearance = 0 'Flat
Caption = "查询储户(&S)"
CausesValidation= 0 'False
Height = 375
Left = 5640
TabIndex = 13
Top = 240
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "frmSearchForm.frx":1272
Left = 720
List = "frmSearchForm.frx":127C
TabIndex = 6
Text = "存款记录"
Top = 1080
Width = 1815
End
Begin VB.TextBox txtUserID
DataField = "档案号"
ForeColor = &H00000000&
Height = 270
Left = 720
MaxLength = 50
TabIndex = 5
Top = 240
Width = 1815
End
Begin VB.TextBox txtUserName
Height = 270
Left = 720
TabIndex = 4
Top = 660
Width = 1815
End
Begin VB.TextBox txtPwd
Height = 270
IMEMode = 3 'DISABLE
Left = 3600
PasswordChar = "*"
TabIndex = 3
Top = 240
Width = 1815
End
Begin VB.TextBox txtChangePwd
Height = 270
IMEMode = 3 'DISABLE
Left = 3600
PasswordChar = "*"
TabIndex = 2
Top = 660
Width = 1815
End
Begin VB.TextBox txtPwdAgain
Height = 270
IMEMode = 3 'DISABLE
Left = 3600
PasswordChar = "*"
TabIndex = 1
Top = 1080
Width = 1815
End
Begin ComctlLib.ListView lvw
Height = 1095
Left = 120
TabIndex = 16
Top = 1440
Width = 6735
_ExtentX = 11880
_ExtentY = 1931
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 327682
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "帐号:"
ForeColor = &H00000000&
Height = 180
Index = 14
Left = 120
TabIndex = 12
Top = 285
Width = 540
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓名:"
ForeColor = &H00000000&
Height = 180
Index = 15
Left = 120
TabIndex = 11
Top = 705
Width = 540
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "文件:"
Height = 180
Index = 16
Left = 120
TabIndex = 10
Top = 1080
Width = 540
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "原密码:"
ForeColor = &H00000000&
Height = 180
Index = 13
Left = 2820
TabIndex = 9
Top = 285
Width = 840
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "更改密码:"
ForeColor = &H00000000&
Height = 180
Index = 17
Left = 2640
TabIndex = 8
Top = 705
Width = 900
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "重复密码:"
ForeColor = &H00000000&
Height = 180
Index = 18
Left = 2640
TabIndex = 7
Top = 1080
Width = 900
End
End
End
Attribute VB_Name = "frmSearchForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdChangePwd_Click()
If txtChangePwd <> txtPwdAgain Then
MsgBox "更改密码两次输入不一致,请重新输入!", vbCritical, "提示:"
Exit Sub
End If
If lvw.SelectedItem.Text = "" Then Exit Sub
Dim db As Database, rs As Recordset, SqlStr As String
Set db = OpenDatabase(App.Path & "\bank.mdb")
Set rs = db.OpenRecordset(Combo1, dbOpenDynaset)
SqlStr = "姓名='" & lvw.SelectedItem.Text & "'" & "AND 帐号='" & lvw.SelectedItem.SubItems(1) & "'"
rs.FindFirst SqlStr
If Not rs.NoMatch Then
If txtPwd = Decipher(rs!密码) Then
rs.Edit
rs!密码 = Cipher(txtChangePwd)
rs.Update
MsgBox "储户 [" & lvw.SelectedItem & "]的密码已更改!", vbInformation, "提示:"
Else
MsgBox "储户原密码不正确,不能更新密码!", vbCritical, "警告:"
End If
Else
MsgBox "更改出错,原因:没有找到相应的记录", vbCritical, "提示:"
End If
db.Close
txtPwd = ""
txtChangePwd = ""
txtPwdAgain = ""
End Sub
Private Sub CmdSearch_Click()
Dim IsFound As Boolean
Dim db As Database, rs As Recordset, SqlStr As String
Dim i As Integer
If txtUserName = "" And txtUserID = "" Then
MsgBox "请检查帐号或姓名是否填写", vbInformation, "提示:"
Exit Sub
End If
Set db = OpenDatabase(App.Path & "\bank.mdb")
Set rs = db.OpenRecordset(Combo1, dbOpenDynaset)
Do While Not rs.EOF()
If txtUserName <> "" And txtUserID <> "" Then
If rs!帐号 = txtUserID And rs!姓名 = txtUserName Then
i = i + 1
lvw.ListItems.Add , "first" & i, rs!姓名
lvw.ListItems("first" & i).SubItems(1) = rs!帐号
lvw.ListItems("first" & i).SubItems(2) = rs!储种
lvw.ListItems("first" & i).SubItems(3) = rs!存款日期
lvw.ListItems("first" & i).SubItems(4) = rs!本金
lvw.ListItems("first" & i).SubItems(5) = rs!地址
IsFound = True
End If
End If
If txtUserName = "" And txtUserID <> "" Then
If rs!帐号 = txtUserID Then
i = i + 1
lvw.ListItems.Add , "first" & i, rs!姓名
lvw.ListItems("first" & i).SubItems(1) = rs!帐号
lvw.ListItems("first" & i).SubItems(2) = rs!储种
lvw.ListItems("first" & i).SubItems(3) = rs!存款日期
lvw.ListItems("first" & i).SubItems(4) = rs!本金
lvw.ListItems("first" & i).SubItems(5) = rs!地址
End If
IsFound = True
End If
If txtUserName <> "" And txtUserID = "" Then
If rs!姓名 = txtUserName Then
i = i + 1
lvw.ListItems.Add , "first" & i, rs!姓名
lvw.ListItems("first" & i).SubItems(1) = rs!帐号
lvw.ListItems("first" & i).SubItems(2) = rs!储种
lvw.ListItems("first" & i).SubItems(3) = rs!存款日期
lvw.ListItems("first" & i).SubItems(4) = rs!本金
lvw.ListItems("first" & i).SubItems(5) = rs!地址
End If
IsFound = True
End If
rs.MoveNext
Loop
If IsFound = False Then
MsgBox "没有找到该条记录!", vbInformation, "查找结果:"
Else
MsgBox "共找到 " & i & " 条记录符合条件", vbInformation, "查找结果:"
End If
End Sub
Private Sub EnablePwd()
CmdChangePwd.Enabled = True
txtPwd.Enabled = True
txtPwd.BackColor = &H80000005
txtChangePwd.Enabled = True
txtChangePwd.BackColor = &H80000005
txtPwdAgain.Enabled = True
txtPwdAgain.BackColor = &H80000005
End Sub
Private Sub Combo1_GotFocus()
ShowFocus Combo1
End Sub
Private Sub Combo1_LostFocus()
LeaveFocus Combo1
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim header As ColumnHeader
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2, Me.Width, Me.Height
AniShowFrm Me.hwnd
DisablePwd
lvw.View = lvwReport
lvw.ColumnHeaders.Clear
Set header = lvw.ColumnHeaders.Add(, "first", "姓名", 800) 'set listview width
Set header = lvw.ColumnHeaders.Add(, "second", "帐号", 1000)
Set header = lvw.ColumnHeaders.Add(, "third", "储种", 800)
Set header = lvw.ColumnHeaders.Add(, "fouth", "存款日期", 1000)
Set header = lvw.ColumnHeaders.Add(, "sixth", "本金", 1000)
Set header = lvw.ColumnHeaders.Add(, "tenth", "地址", 3000)
End Sub
Private Sub Form_Unload(Cancel As Integer)
AniUnloadFrm Me.hwnd
End Sub
Private Sub DisablePwd()
txtPwd.Enabled = False
txtPwd.BackColor = &H80000000
txtChangePwd.Enabled = False
txtChangePwd.BackColor = &H80000000
txtPwdAgain.Enabled = False
txtPwdAgain.BackColor = &H80000000
CmdChangePwd.Enabled = False
End Sub
Private Sub lvw_Click()
If lvw.SelectedItem.Text <> "" Then
EnablePwd
End If
End Sub
Private Sub txtChangePwd_Change()
If Len(txtChangePwd) >= 6 Then
txtChangePwd = Left(txtChangePwd, 6)
SendKeys "{tab}"
End If
End Sub
Private Sub txtChangePwd_GotFocus()
ShowFocus txtChangePwd
End Sub
Private Sub txtChangePwd_LostFocus()
LeaveFocus txtChangePwd
End Sub
Private Sub txtPwd_Change()
If Len(txtPwd) >= 6 Then
txtPwd = Left(txtPwd, 6)
SendKeys "{tab}"
End If
End Sub
Private Sub txtPwd_GotFocus()
ShowFocus txtPwd
End Sub
Private Sub txtPwd_LostFocus()
LeaveFocus txtPwd
End Sub
Private Sub txtPwdAgain_Change()
If Len(txtPwdAgain) >= 6 Then
txtPwdAgain = Left(txtPwdAgain, 6)
SendKeys "{tab}"
End If
End Sub
Private Sub txtPwdAgain_GotFocus()
ShowFocus txtPwdAgain
End Sub
Private Sub txtPwdAgain_LostFocus()
LeaveFocus txtPwdAgain
End Sub
Private Sub txtUserID_GotFocus()
ShowFocus txtUserID
End Sub
Private Sub txtUserID_LostFocus()
LeaveFocus txtUserID
End Sub
Private Sub txtUserName_GotFocus()
ShowFocus txtUserName
End Sub
Private Sub txtUserName_LostFocus()
LeaveFocus txtUserName
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -