📄 frm_xtgl_czy.frm
字号:
EndProperty
BorderStyle = 1
End
Begin MSComctlLib.ImageList ImageList1
Left = -30
Top = 2925
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 26
ImageHeight = 26
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 7
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Xtgl_Czy.frx":5328
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Xtgl_Czy.frx":6982
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Xtgl_Czy.frx":7FDC
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Xtgl_Czy.frx":9636
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Xtgl_Czy.frx":AC90
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Xtgl_Czy.frx":C2EA
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Xtgl_Czy.frx":D944
Key = ""
EndProperty
EndProperty
End
End
Attribute VB_Name = "Frm_Xtgl_Czy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Public blnAdd As Boolean
Dim mybookmark
Sub view_data() '显示数据信息
Dim i As Integer
If Adodc1.Recordset.RecordCount > 0 Then
Txt_Id.Text = Adodc1.Recordset.Fields(0)
Txt_Czy.Text = Adodc1.Recordset.Fields(1)
Txt_mm.Text = Adodc1.Recordset.Fields(2)
Txt_Qr.Text = Adodc1.Recordset.Fields(2)
ImageCombo1.Text = Adodc1.Recordset.Fields(3)
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Frm_Main.Enabled = True
End Sub
Private Sub ImageCombo1_GotFocus()
ImageCombo1.BackColor = &HFFFF80
End Sub
Private Sub ImageCombo1_LostFocus()
ImageCombo1.BackColor = &HFFFFFF
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.key
Case "add"
blnAdd = True
tlbState Toolbar1, True
Dim rs1 As New ADODB.Recordset
rs1.Open "select * from tb_user order by user_id", cnn, adOpenKeyset
If rs1.RecordCount > 0 Then
rs1.MoveLast
Txt_Id.Text = "ID" + Format(Val(Right(Trim(rs1.Fields("user_id")), 3)) + 1, "###000") '编号自动加1
Else
Txt_Id.Text = "ID001"
End If
rs1.Close
Txt_Czy.Text = ""
Txt_mm.Text = ""
Txt_Qr.Text = ""
ImageCombo1.Text = ""
Txt_Id.Locked = False
Txt_Czy.Locked = False
Txt_mm.Locked = False
Txt_Qr.Locked = False
ImageCombo1.Locked = False
Txt_Czy.SetFocus
' Case "modify"
' Adodc1.RecordSource = "select * from tb_user where user_id ='" + Txt_Id + "'"
' Adodc1.Refresh
' If Adodc1.Recordset.RecordCount > 0 Then
' blnAdd = False
' tlbState Toolbar1, True
' Txt_Id.Locked = False
' Txt_Czy.Locked = False
' Txt_Mm.Locked = False
' Txt_Qr.Locked = False
' view_data
' Txt_Id.Enabled = True
' Txt_Czy.Enabled = True
' Txt_Mm.Enabled = True
' Txt_Qr.Enabled = True
' Else
' MsgBox "系统没有要修改的数据!", , "提示窗口"
' End If
Case "delete"
Adodc1.RecordSource = "select * from tb_user where user_id='" + Txt_Id + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete
Adodc1.Refresh
Txt_Id.Text = ""
Txt_Czy.Text = ""
Txt_mm.Text = ""
Txt_Qr.Text = ""
ImageCombo1.Text = ""
ImageCombo1.Text = ""
Adodc1.RecordSource = "select * from tb_user "
Adodc1.Refresh
Call view_data
Else
MsgBox "系统没有要删除的数据!", , "提示窗口"
End If
Case "save"
On Error GoTo SaveErr
If Txt_Czy.Text = "" Then
MsgBox "操作员姓名不能为空!", , "信息提示"
Exit Sub
End If
If Txt_mm.Text = "" Then
MsgBox "操作员密码不能为空!", , "信息提示"
Exit Sub
End If
If Txt_Qr.Text = "" Then
MsgBox "确认密码不能为空!", , "信息提示"
Exit Sub
End If
If ImageCombo1.Text = "" Then
MsgBox "请选择操作员头像!", , "信息提示"
ImageCombo1.SetFocus
Exit Sub
End If
If Txt_mm <> Txt_Qr Then
MsgBox "两次输入的密码不一致!", , "信息提示"
Exit Sub
End If
' If blnAdd = True Then
Adodc1.RecordSource = "select * from tb_user where User_name='" + Txt_Czy.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MsgBox "该操作员已经存在!", , "信息提示"
Txt_Czy.Text = ""
Txt_Czy.SetFocus
Exit Sub
Else
cnn.Execute ("insert into tb_user(user_id,user_name,user_mm,user_Tx) values('" + Txt_Id.Text + _
"','" + Txt_Czy + "','" + Txt_mm + "','" + ImageCombo1.Text + "')")
tlbState Toolbar1, False
Txt_Id.Locked = True
Txt_Czy.Locked = True
Txt_mm.Locked = True
Txt_Qr.Locked = True
ImageCombo1.Locked = True
End If
' Else
' Cnn.Execute ("update tb_user set user_name ='" + Txt_Czy + "',user_mm ='" + Txt_Mm.Text + "',user_tx='" + ImageCombo1.Text + "' where user_id='" + Txt_Id.Text + "'")
' tlbState Toolbar1, False
' Txt_Id.Locked = True
' Txt_Czy.Locked = True
' Txt_Mm.Locked = True
' Txt_Qr.Locked = True
' ImageCombo1.Locked = True
' End If
Unload Me
Frm_Xtgl_Czy.Show 1
Exit Sub
SaveErr:
MsgBox Err.Description, , "信息提示"
Case "cancel" '取消
tlbState Toolbar1, False
Txt_Id.Locked = True
Txt_Czy.Locked = True
Txt_mm.Locked = True
Txt_Qr.Locked = True
ImageCombo1.Locked = True
Txt_Id.Text = ""
Txt_Czy.Text = ""
Txt_mm.Text = ""
Txt_Qr.Text = ""
ImageCombo1.Text = ""
Adodc1.RecordSource = "select * from tb_user order by user_id"
Adodc1.Refresh
Call view_data
Case "find"
Tb = "tb_user"
Mystr = InputBox("请输入要查询的操作员编号", "操作员信息查询", "ID001")
rs1.Open "select * from tb_user where user_id ='" + Mystr + "'", cnn, adOpenKeyset
If rs1.RecordCount > 0 Then
Txt_Id.Text = rs1.Fields(0)
Txt_Czy.Text = rs1.Fields(1)
Txt_mm.Text = rs1.Fields(2)
Txt_Qr.Text = rs1.Fields(2)
ImageCombo1.Text = rs1.Fields(3)
End If
rs1.Close
Txt_Id.Locked = True
Txt_Czy.Locked = True
Txt_mm.Locked = True
Txt_Qr.Locked = True
ImageCombo1.Locked = True
Case "close"
Unload Me
End Select
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = PublicStr
Dim NewItem As ComboItem '声明一个ComboItem对象
Dim i As Integer '声明一个整型变量
For i = 1 To 10
Set NewItem = ImageCombo1.ComboItems.Add(i, "头像" & i, "头像" & i, "头像" & i)
Next i
End Sub
Private Sub Txt_Czy_GotFocus()
Txt_Czy.BackColor = &HFFFF80
End Sub
Private Sub Txt_Czy_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Txt_mm.SetFocus
End Sub
Private Sub Txt_Czy_LostFocus()
Txt_Czy.BackColor = &HFFFFFF
End Sub
Private Sub Txt_mm_GotFocus()
Txt_mm.BackColor = &HFFFF80
End Sub
Private Sub Txt_mm_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Txt_Qr.SetFocus
End Sub
Private Sub Txt_mm_LostFocus()
Txt_mm.BackColor = &HFFFFFF
End Sub
Private Sub Txt_Qr_GotFocus()
Txt_Qr.BackColor = &HFFFF80
End Sub
Private Sub Txt_Qr_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then ImageCombo1.SetFocus
End Sub
Private Sub Txt_Qr_LostFocus()
Txt_Qr.BackColor = &HFFFFFF
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -