📄 main_czy.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form main_czy
Caption = "系统设置-〖操作员设置〗"
ClientHeight = 2025
ClientLeft = 60
ClientTop = 450
ClientWidth = 4470
LinkTopic = "Form1"
ScaleHeight = 2025
ScaleWidth = 4470
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton ComDelete
Caption = "删除"
Height = 375
Left = 2280
TabIndex = 8
Top = 1440
Width = 885
End
Begin VB.CommandButton ComAdd
Caption = "添加"
Height = 375
Left = 360
TabIndex = 7
Top = 1440
Width = 885
End
Begin VB.CommandButton ComSave
Caption = "保存"
Height = 375
Left = 1320
TabIndex = 6
Top = 1440
Width = 885
End
Begin VB.CommandButton ComEnd
Caption = "退出"
Height = 375
Left = 3240
TabIndex = 5
Top = 1440
Width = 885
End
Begin VB.Frame Frame1
Height = 1095
Left = 360
TabIndex = 0
Top = 240
Width = 3795
Begin VB.TextBox Text1
Height = 285
IMEMode = 3 'DISABLE
Index = 1
Left = 1515
MaxLength = 6
PasswordChar = "*"
TabIndex = 2
Top = 660
Width = 2055
End
Begin VB.ComboBox Combo1
Height = 315
Left = 1530
TabIndex = 1
Top = 240
Width = 2055
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "操作员 "
Height = 330
Left = 675
TabIndex = 4
Top = 330
Width = 870
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密码 "
Height = 285
Left = 720
TabIndex = 3
Top = 720
Width = 645
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 720
Top = 2040
Visible = 0 'False
Width = 1575
_ExtentX = 2778
_ExtentY = 661
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 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=khgl.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=khgl.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from ma"
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
End
Attribute VB_Name = "main_czy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Private Sub Combo1_Click()
Text1(1).SetFocus
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(1).SetFocus
Else
End If
End Sub
Private Sub Form_Load()
Adodc1.RecordSource = "select * from ma "
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
Combo1.AddItem (Adodc1.Recordset.Fields("操作员"))
Adodc1.Recordset.MoveNext
Loop
Else
End If
ComSave.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Frm_main.Enabled = True
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
Select Case Index
Case 0
If Index = 0 And KeyCode = vbKeyReturn Then Text1(1).SetFocus
Case 1
If Index = 1 And KeyCode = vbKeyReturn Then ComSave.SetFocus
End Select
End Sub
Private Sub ComAdd_Click()
ComSave.Enabled = True
ComAdd.Enabled = False
Combo1.SetFocus
End Sub
Private Sub ComSave_Click()
Adodc1.RecordSource = "select * from ma where 操作员='" + Combo1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MsgBox "用户名已经存在,注册不成功!", , "信息提示"
Combo1.Text = ""
Combo1.SetFocus
Else
Adodc1.Recordset.AddNew
If Combo1.Text <> "" Then Adodc1.Recordset.Fields(0) = Combo1.Text
If Text1(1).Text <> "" Then
Adodc1.Recordset.Fields(1) = Text1(1).Text
Adodc1.Recordset.Fields(2) = "0"
Adodc1.Recordset.Fields(3) = "0"
Adodc1.Recordset.Fields(4) = "0"
Adodc1.Recordset.Fields(5) = "0"
Else
End If
Adodc1.Recordset.Update
Adodc1.Refresh
MsgBox "添加成功!"
ComSave.Enabled = False
ComAdd.Enabled = True
End If
End Sub
Private Sub ComDelete_Click()
Adodc1.RecordSource = "select * from ma where 操作员='" + Combo1.Text + "'"
Adodc1.Refresh
If Trim(Combo1.Text) = Name1 Then
MsgBox "不能删除当前操作员!", , "提示信息"
Else
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.Delete
MsgBox "信息删除成功!", , "信息提示"
Else
MsgBox "请选择要删除的操作员名称", , "信息提示"
Combo1.SetFocus
End If
End If
End Sub
Private Sub ComEnd_Click()
Frm_main.Enabled = True
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -