📄 chinfo.frm
字号:
VERSION 5.00
Begin VB.Form Chinfo
BorderStyle = 1 'Fixed Single
Caption = "Form1"
ClientHeight = 2205
ClientLeft = 5775
ClientTop = 3675
ClientWidth = 4530
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2205
ScaleWidth = 4530
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2640
TabIndex = 7
Top = 1680
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 720
TabIndex = 6
Top = 1680
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Chinfo.frx":0000
Left = 1440
List = "Chinfo.frx":000A
TabIndex = 2
Text = "用户类型"
Top = 1080
Width = 2535
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 1440
MaxLength = 20
TabIndex = 1
Top = 600
Width = 2535
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 375
Left = 1440
Locked = -1 'True
TabIndex = 0
Top = 120
Width = 2535
End
Begin VB.Label Label3
Caption = "用户类型:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 5
Top = 1080
Width = 1215
End
Begin VB.Label Label2
Caption = "口 令:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 4
Top = 600
Width = 975
End
Begin VB.Label Label1
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 3
Top = 120
Width = 975
End
End
Attribute VB_Name = "Chinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Mchange As Boolean
Dim temptime As Integer
Private Sub Command1_Click()
Dim Psw As String
If Mchange = True Then
Psw = InputBox("请确认密码:", "密码确认")
If Psw <> Text2.Text Then '密码不符
MsgBox "新密码不匹配!", vbExclamation + vbOKOnly, "信息"
Exit Sub
End If
End If
If Text2.Text = "" Then
MsgBox "为了安全起见,口令不允许为空,请重新设定!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
'确认通过
If Trim(Combo1.Text) <> "超级用户" And Trim(Combo1.Text) <> "普通用户" Then
MsgBox "请选择用户类型!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
'下面更新数据库和用户列表
'先更新数据库
Dim Rs As ADODB.Recordset
'Set Rs = New ADODB.Recordset
Dim Sql As String
Dim Temp As String
If Trim(Combo1.Text) = "超级用户" Then
Temp = "0"
Else
Temp = "1"
End If
Sql = "update userinfo set Userpassword='" & Text2.Text & "'," & "Usertype='" & Temp & "' where Username='" & Text1.Text & "'"
If Not mExecuteSql(Sql, Rs) Then
MsgBox "更新失败!"
Exit Sub
Else
MsgBox "更新成功!", vbOKOnly + vbInformation, "信息"
End If
'然后更新用户列表
Dim i As Integer
With Userm
For i = 1 To .grid.Rows - 1
If .grid.TextMatrix(i, 0) = Text1.Text Then
.grid.TextMatrix(i, 1) = Text2.Text
.grid.TextMatrix(i, 2) = Combo1.Text
Exit For
End If
Next
End With
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
temptime = 0
Mchange = False
End Sub
Private Sub Text2_Change()
temptime = temptime + 1
If temptime > 1 Then '口令已经变更
Mchange = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -