📄 frmsuperedit.frm
字号:
VERSION 5.00
Begin VB.Form frmSuperEdit
BorderStyle = 3 'Fixed Dialog
Caption = "Form1"
ClientHeight = 3405
ClientLeft = 45
ClientTop = 330
ClientWidth = 3705
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmSuperEdit.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3405
ScaleWidth = 3705
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdCancel
Caption = "取消"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 2430
TabIndex = 5
Top = 2745
Width = 1050
End
Begin VB.CommandButton cmdOK
Caption = "确定"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1260
TabIndex = 4
Top = 2745
Width = 1050
End
Begin VB.TextBox txtName
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1395
TabIndex = 3
Top = 2070
Width = 2040
End
Begin VB.TextBox txtSecPass
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
IMEMode = 3 'DISABLE
Left = 1395
PasswordChar = "*"
TabIndex = 2
Top = 1440
Width = 2040
End
Begin VB.TextBox txtFirstPass
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
IMEMode = 3 'DISABLE
Left = 1395
PasswordChar = "*"
TabIndex = 1
Top = 810
Width = 2040
End
Begin VB.TextBox txtOperID
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1395
TabIndex = 0
Top = 225
Width = 2040
End
Begin VB.Label Label4
Caption = "管理员姓名:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 315
TabIndex = 9
Top = 2115
Width = 1095
End
Begin VB.Label Label3
Caption = "确认密码:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 315
TabIndex = 8
Top = 1485
Width = 1050
End
Begin VB.Label Label2
Caption = "密码:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 315
TabIndex = 7
Top = 855
Width = 1005
End
Begin VB.Label Label1
Caption = "管理员ID:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 315
TabIndex = 6
Top = 315
Width = 1050
End
End
Attribute VB_Name = "frmSuperEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*******************************************************
'* 模 块 名 称 :新增(修改)管理员
'* 功 能 描 述 :
'* 程序员姓名 :谭怀志
'* 最后修改人 :谭怀志
'* 最后修改时间:2003/6/26
'* 备 注:
'*******************************************************
Option Explicit
Private Sub cmdCancel_Click()
On Error Resume Next
Select Case Me.Tag
Case "First"
'启动系统时,若无管理员新增管理员,按“取消”按钮退出系统
End
Case Else
Unload Me
End Select
End Sub
Private Sub cmdOK_Click()
On Error GoTo VBError
'检查管理员资料是否正确
If Trim(txtOperID.Text) = "" Then
MsgBox "管理员ID必须填写!", vbCritical, ERRCAPTION
txtOperID.SetFocus
Exit Sub
End If
If Trim(txtName.Text) = "" Then
MsgBox "姓名必须填写!", vbCritical, ERRCAPTION
txtName.SetFocus
Exit Sub
End If
If txtFirstPass.Text <> "" And txtFirstPass.Text <> txtSecPass.Text Then
MsgBox "两次输入的密码不一致!", vbCritical, ERRCAPTION
txtFirstPass.SetFocus
Exit Sub
End If
txtOperID.Text = Replace(txtOperID.Text, "'", "''")
txtFirstPass.Text = Replace(txtFirstPass.Text, "'", "''")
txtName.Text = Replace(txtName.Text, "'", "''")
On Error GoTo ADOError
Select Case Me.Tag
Case "First"
'启动系统时,新增管理员
strQry = "insert into JFoperator(operID,Password,Name) values('" & Trim(txtOperID.Text) & "','" & Cipher(CODEPASSWORD, txtFirstPass.Text) & "','" & Trim(txtName.Text) & "')"
cnnConnection.Execute strQry
blnLoginFlag = True
strOperatorID = Trim(txtOperID.Text)
frmMain.Show
Unload Me
Case "AddNew"
'启动系统后,新增管理员
strQry = "select OperID from JFoperator where operID='" & Trim(txtOperID.Text) & "'"
Set rstCustomers = GetRecordSet(cnnConnection, strQry)
If rstCustomers.RecordCount <> 0 Then
MsgBox "ID为 " & Trim(txtOperID.Text) & " 的管理员已经存在!", vbCritical, ERRCAPTION
txtOperID.SetFocus
SendKeys "{HOME}+{END}"
Exit Sub
End If
strQry = "insert into JFoperator(operID,Password,Name) values('" & Trim(txtOperID.Text) & "','" & Cipher(CODEPASSWORD, txtFirstPass.Text) & "','" & Trim(txtName.Text) & "')"
cnnConnection.Execute strQry
With frmSuper!Gridbrowser
.AddItem ""
.RowHeight(.Rows - 1) = 350
.TextMatrix(.Rows - 1, 0) = Trim(txtOperID.Text)
.TextMatrix(.Rows - 1, 1) = Trim(txtName.Text)
.TextMatrix(.Rows - 1, 2) = txtFirstPass.Text
End With
Unload Me
Case "Modify"
'修改管理员
strQry = "update JFoperator set Password='" & Cipher(CODEPASSWORD, Trim(txtFirstPass.Text)) & "',Name='" & Trim(txtName.Text) & "' where OperID='" & txtOperID.Text & "'"
cnnConnection.Execute strQry
With frmSuper!Gridbrowser
.TextMatrix(.RowSel, 0) = txtOperID.Text
.TextMatrix(.RowSel, 1) = txtName.Text
.TextMatrix(.RowSel, 2) = txtFirstPass.Text
End With
Unload Me
End Select
Exit Sub
VBError:
DisplayVBError
Exit Sub
ADOError:
DisplayADOError cnnConnection
End Sub
Private Sub Form_Resize()
On Error Resume Next
Select Case Me.Tag
Case "First"
Me.Caption = "管理员注册"
Case "AddNew"
Me.Caption = "新增管理员"
Case "Modify"
Me.Caption = "修改管理员资料"
txtOperID.Enabled = False
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -