📄 form11.frm
字号:
Top = 945
Width = 1635
End
Begin VB.TextBox Text1
BackColor = &H00C0C0FF&
Height = 285
Left = 750
Locked = -1 'True
TabIndex = 10
Top = 510
Width = 1620
End
Begin VB.Label Label12
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "清空相片"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 180
Left = 3105
TabIndex = 31
Top = 1440
Width = 720
End
Begin VB.Label Label11
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "暂无"
ForeColor = &H00808080&
Height = 180
Left = 3705
TabIndex = 30
Top = 2250
Width = 360
End
Begin VB.Label Label10
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "加入及修改审核人相片"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 180
Left = 585
TabIndex = 28
Top = 1440
Width = 1800
End
Begin VB.Image Image1
BorderStyle = 1 'Fixed Single
Height = 1275
Left = 3060
Stretch = -1 'True
Top = 1770
Width = 1695
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "相片"
Height = 180
Left = 2685
TabIndex = 27
Top = 1800
Width = 360
End
Begin VB.Label Label7
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "备注"
Height = 180
Left = 90
TabIndex = 9
Top = 3045
Width = 360
End
Begin VB.Label Label6
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "住址"
Height = 180
Left = 90
TabIndex = 8
Top = 2445
Width = 375
End
Begin VB.Label Label5
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "电话"
Height = 180
Left = 2685
TabIndex = 7
Top = 1020
Width = 375
End
Begin VB.Label Label4
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "出生日期"
Height = 180
Left = 90
TabIndex = 6
Top = 1785
Width = 720
End
Begin VB.Label Label3
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "性别"
Height = 180
Left = 2685
TabIndex = 5
Top = 540
Width = 375
End
Begin VB.Label Label2
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓名"
Height = 180
Left = 150
TabIndex = 4
Top = 1050
Width = 375
End
Begin VB.Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "编号"
Height = 180
Left = 150
TabIndex = 3
Top = 480
Width = 375
End
End
Begin VB.Label Lbl11
Height = 315
Left = 480
TabIndex = 29
Top = 8520
Width = 3660
End
Begin VB.Label Label9
BackColor = &H00FFC0FF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 315
Left = 150
TabIndex = 25
Top = 6810
Width = 5055
End
End
Attribute VB_Name = "Form11"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer '用于FOR循环中的变量
Dim StrNum As Long '定义一个用于保存窗口信息的变量
Private Sub Cmd_Add_Click()
Label10.Visible = True
On Error Resume Next
Text1.Text = ""
Text2.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Adodc1.RecordSource = "select * from jiben_ren order by 编号"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
StrNum = Val(Adodc1.Recordset.Fields("编号")) + 1
Text1.Text = StrNum
Else
Text1.Text = "1" '如果数据库中没有记录,则给编号赋一个初值
End If
Text2.SetFocus
Lbl11.Caption = ""
Image1.Picture = LoadPicture()
cmd_save.Enabled = True
cmd_del.Enabled = False
cmd_edit.Enabled = False
End Sub
Private Sub Cmd_del_Click()
If Adodc1.Recordset.EOF = False Then
c = MsgBox("您确认要删除该记录吗?", 17, "删除提示信息")
If c = vbOK Then
If Text1.Text = "" Then
MsgBox "请选择您要删除的记录!", 48, "提示"
Else
Adodc1.Recordset.Delete '删除所选中的记录信息
Adodc1.Refresh
Text1.Text = ""
Text2.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = "" '在删除完信息之后,清空文本框中的内容
Image1.Picture = LoadPicture()
' Lbl11.Caption = ""
cmd_del.Enabled = False
Call TRefresh '调用数据刷新过程
End If
End If
Else
MsgBox "当前数据库中已经没有可删除的记录", 64, "提示信息"
End If
End Sub
Private Sub Cmd_edit_Click()
If Text2.Text = "" Then
MsgBox "请选择需要改动的记录信息!", 48, "信息提示"
Else
c = MsgBox("确认要修改该记录吗?", 33, "修改信息提示")
If c = vbOK Then '如果确认修改的话进行修改操作
If Text1.Text = "" Then
MsgBox "供应商名称不能为空值!", 48, "修改信息提示"
Else
Call main '调用公共模块中的连接数据库函数
Set adoRs = adoCon.Execute("UPDATE jiben_ren SET 姓名='" + Text2.Text + "',性别='" + Combo1.Text + "',出生日期='" + Str(DTPicker1.Value) + "',电话='" + Text5.Text + "',住址='" + Text6.Text + "', 备注='" + Text7.Text + "', 相片='" + Lbl11.Caption + "' where 编号='" + Text1 + "'")
MsgBox "信息修改成功", 64, "修改信息提示"
cmd_edit.Enabled = False
adoCon.Close '关闭数据连接
Call TRefresh '调用数据刷新过程
End If
Else
End If
End If
End Sub
Private Sub Cmd_exit_Click()
Unload Me
End Sub
Private Sub Cmd_save_Click()
c = MsgBox("您确认要保存该信息吗?", 33, "保存信息提示")
If c = vbOK Then
If Text2.Text = "" Then
MsgBox "审核人信息不能为空值!", 48, "保存信息提示"
Else
Call main '调用公共模块中的连接数据库函数
'保存
Set adoRs = adoCon.Execute("insert into jiben_ren(编号,姓名,性别,出生日期,电话,住址,备注,相片) values('" & Text1.Text & "','" & Text2.Text & "','" & Combo1.Text & "','" & Str(DTPicker1.Value) & "','" & Text5.Text & "','" & Text6.Text & "','" & Text7.Text & "','" & Lbl11.Caption & "')")
MsgBox "信息保存成功", 64, "保存信息提示"
cmd_save.Enabled = False
adoCon.Close
Call TRefresh '调用数据刷新过程
End If
Else
End If
End Sub
Private Sub Command1_Click()
form12.Text1(8).Text = Text1.Text
Form13.Text1(5).Text = Text1.Text
Form14.Text1(5).Text = Text1.Text
Form15.Text1(5).Text = Text1.Text
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
tb = "jiben_ren"
riqi = "出生日期"
Form17.Show 1
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
Call JionBack '调用数据信息反绑定过程
cmd_del.Enabled = True
cmd_edit.Enabled = True
cmd_save.Enabled = False
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Combo1.ListIndex = 0
End Sub
' 自定义数据信息反绑定的过程
Private Sub JionBack()
On Error Resume Next '执行错误处理
Dim SLen As Integer
If Adodc1.Recordset.RecordCount > 0 Then
StrNum = Val(Adodc1.Recordset.Fields("编号"))
'将数据信息反绑定到文本框当中
Text1.Text = Trim(Adodc1.Recordset(0)) 'trim太重要了
Text2.Text = Trim(Adodc1.Recordset(1))
Combo1.Text = Trim(Adodc1.Recordset(2))
DTPicker1.Value = Trim(Adodc1.Recordset(3))
Text5.Text = Trim(Adodc1.Recordset(4))
Text6.Text = Trim(Adodc1.Recordset(5))
Text7.Text = Trim(Adodc1.Recordset(7))
Lbl11.Caption = Trim(Adodc1.Recordset(6))
End If
End Sub
' 自定义数据刷新的过程
Private Sub TRefresh()
Adodc1.RecordSource = "select * from jiben_ren order by 编号"
Adodc1.Refresh
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
sql = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form2.Enabled = True
End Sub
Private Sub Label10_Click()
'添加职工相片
With CDialog1
.DialogTitle = "选择要加入的职工相片"
.Filter = "jpg图片|*.jpg"
.ShowOpen '打开对话框
Image1.Picture = LoadPicture(.FileName)
Lbl11.Caption = .FileName
End With
End Sub
Private Sub Label12_Click()
Image1.Picture = LoadPicture()
Lbl11.Caption = ""
End Sub
Private Sub Timer1_Timer()
If Adodc1.Recordset.RecordCount > 0 Then
Label9.Caption = "目前数据库中共有 " & Adodc1.Recordset.RecordCount & " 条审核人数据"
Else
Label9.Caption = "目前数据库中尚没有审核人记录"
End If
If Len(Lbl11.Caption) = 0 Then '************由LBL11的长度来决定是否显示“暂无”**外面只需否则lbl11.caption的值即可*****************************
Label11.Visible = True
Image1.Picture = LoadPicture()
Else
Label11.Visible = False
Image1.Picture = LoadPicture(Lbl11.Caption)
End If
End Sub
Private Sub Form_Activate()
If sql <> "" Then
Adodc1.RecordSource = sql1
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Call JionBack
Adodc1.Recordset.Update
Else
MsgBox "没有找到符合条件的记录!", 64, "提示窗口"
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -