📄 frmczygl.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form FrmCZYGL
Caption = "操作员管理"
ClientHeight = 4845
ClientLeft = 60
ClientTop = 345
ClientWidth = 6555
LinkTopic = "Form1"
ScaleHeight = 4845
ScaleWidth = 6555
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
Height = 315
IMEMode = 3 'DISABLE
Left = 1500
MaxLength = 10
TabIndex = 7
Text = "1234567890"
Top = 1080
Width = 1380
End
Begin VB.TextBox Text2
Height = 315
Left = 4305
MaxLength = 7
TabIndex = 6
Text = "Text2"
Top = 360
Width = 1380
End
Begin VB.TextBox Text1
Height = 315
Left = 1515
MaxLength = 8
TabIndex = 5
Text = "Text1"
Top = 360
Width = 1380
End
Begin VB.Frame Frame1
Height = 705
Left = 660
TabIndex = 1
Top = 1560
Width = 5040
Begin VB.CommandButton Command1
Caption = "删除"
Height = 330
Left = 1935
TabIndex = 4
Top = 225
Width = 1215
End
Begin VB.CommandButton Commclose
BackColor = &H000000FF&
Caption = "关闭(&C)"
Height = 330
Left = 3555
Style = 1 'Graphical
TabIndex = 3
Top = 225
Width = 1215
End
Begin VB.CommandButton Commmend
Caption = "增加"
Height = 330
Left = 270
TabIndex = 2
Top = 210
Width = 1215
End
End
Begin VB.ComboBox Combo1
Height = 300
Left = 4290
TabIndex = 0
Text = "Combo1"
Top = 1140
Width = 1275
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 3270
Top = 2310
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "FrmCZYGL.frx":0000
Height = 1440
Left = 600
TabIndex = 8
Top = 2820
Width = 5160
_ExtentX = 9102
_ExtentY = 2540
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1.5
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label4
Caption = "口 令:"
Height = 255
Left = 675
TabIndex = 12
Top = 1140
Width = 1260
End
Begin VB.Label Label3
Caption = "用户代码:"
Height = 255
Left = 3285
TabIndex = 11
Top = 435
Width = 1260
End
Begin VB.Label Label2
Caption = "姓 名::"
Height = 255
Left = 675
TabIndex = 10
Top = 435
Width = 1260
End
Begin VB.Label Label1
Caption = "权 限:"
Height = 255
Left = 3270
TabIndex = 9
Top = 1185
Width = 900
End
End
Attribute VB_Name = "FrmCZYGL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click() '删除按钮的单击事件
On Error Resume Next
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.Delete '有记录可以删除
Adodc1.Refresh '更新数据库
End If
Adodc1.Refresh
End Sub
Private Sub Commclose_Click() '退出按钮的单击事件
On Error Resume Next
Unload Me
End Sub
Private Sub Commmend_Click() '增加按钮的单击事件
On Error Resume Next
If Trim(Text2.Text) = "0000" Then '不能修改管理员
MsgBox "用户代码=0000是管理员,不能修改"
Exit Sub
End If
If Trim(Text1.Text) <> "" And Trim(Text2.Text) <> "" And Trim(Text3.Text) <> "" And Trim(Combo1.Text) <> "" Then
Adodc1.Recordset.Find "编号 ='" + Trim(Text2.Text) + "'" '查找相应的记录
If Adodc1.Recordset.EOF Then '没有找到相应的记录则添加该记录
Adodc1.Recordset.AddNew
Adodc1.Recordset![姓名] = Text1.Text
Adodc1.Recordset![编号] = Text2.Text
Adodc1.Recordset![密码] = Text3.Text
If Combo1.Text = "管理员" Then
Adodc1.Recordset![权限] = 1
Else
Adodc1.Recordset![权限] = 2
End If
Adodc1.Recordset.Update '更新数据库
Else
Adodc1.Recordset![姓名] = Text1.Text '把信息存入数据库中
Adodc1.Recordset![编号] = Text2.Text
Adodc1.Recordset![密码] = Text3.Text
If Combo1.Text = "管理员" Then
Adodc1.Recordset![权限] = 1
Else
Adodc1.Recordset![权限] = 2
End If
Adodc1.Recordset.Update
End If
End If
End Sub
Private Sub Form_Activate()
On Error Resume Next
Text1.SetFocus
End Sub
Private Sub Form_Load()
On Error Resume Next
' Left = (Screen.Width - Me.Width) / 2
' Top = (Screen.Height - Me.Height) / 2
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Adodc1.ConnectionString = adocnstring
Adodc1.RecordSource = "select * from userduty where 编号<>'0000' order by 编号"
Adodc1.Refresh
Combo1.AddItem "管理员"
Combo1.AddItem "值班员"
Combo1.Text = Combo1.List(0)
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) '按回车即可移动焦点使使用更加方便
On Error Resume Next
If KeyCode = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
On Error Resume Next
If KeyCode = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer) '当输入完所有的信息后按回车焦点转移到增加记录按钮上
On Error Resume Next
If KeyCode = 13 Then
Commmend.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -