📄 frm_editgl.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form Frm_editgl
BorderStyle = 1 'Fixed Single
Caption = "修改"
ClientHeight = 4125
ClientLeft = 3600
ClientTop = 2220
ClientWidth = 5085
Icon = "Frm_editgl.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4125
ScaleWidth = 5085
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command2
Caption = "取消"
Height = 320
Left = 3000
TabIndex = 10
Top = 3600
Width = 1155
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 320
Left = 840
TabIndex = 9
Top = 3600
Width = 1095
End
Begin VB.TextBox Text4
Height = 300
Left = 1020
TabIndex = 8
Top = 2340
Width = 3855
End
Begin VB.TextBox Text3
Height = 300
Left = 1020
TabIndex = 7
Top = 1860
Width = 3855
End
Begin VB.TextBox Text2
Height = 300
Left = 1020
TabIndex = 6
Top = 1440
Width = 3855
End
Begin VB.ComboBox Combo4
Height = 300
Left = 3540
TabIndex = 5
Top = 1020
Width = 1335
End
Begin VB.ComboBox Combo3
Height = 300
Left = 1020
TabIndex = 4
Top = 1020
Width = 1395
End
Begin VB.ComboBox Combo2
Height = 300
Left = 3540
TabIndex = 3
Top = 600
Width = 1335
End
Begin VB.ComboBox Combo1
Height = 300
Left = 3540
TabIndex = 2
Top = 180
Width = 1335
End
Begin VB.TextBox Text1
Height = 270
Left = 1020
TabIndex = 1
Top = 180
Width = 1395
End
Begin VB.TextBox Text5
Height = 735
Left = 1020
MultiLine = -1 'True
TabIndex = 0
Top = 2700
Width = 3855
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 315
Left = 1020
TabIndex = 11
Top = 600
Width = 1395
_ExtentX = 2461
_ExtentY = 556
_Version = 393216
CustomFormat = "yyyy-MM-dd"
Format = 16646147
CurrentDate = 38804
End
Begin VB.Label Label9
Caption = "类别"
Height = 195
Left = 180
TabIndex = 21
Top = 2340
Width = 735
End
Begin VB.Label Label8
Caption = "技术特长"
Height = 195
Left = 180
TabIndex = 20
Top = 1920
Width = 795
End
Begin VB.Label Label7
Caption = "家庭住址"
Height = 195
Left = 180
TabIndex = 19
Top = 1500
Width = 795
End
Begin VB.Label Label6
Caption = "技术职称"
Height = 255
Left = 2700
TabIndex = 18
Top = 1080
Width = 795
End
Begin VB.Label Label5
Caption = "政治面貌"
Height = 195
Left = 180
TabIndex = 17
Top = 1080
Width = 795
End
Begin VB.Label Label4
Caption = "文化程度"
Height = 195
Left = 2700
TabIndex = 16
Top = 660
Width = 735
End
Begin VB.Label Label3
Caption = "出生日期"
Height = 195
Left = 180
TabIndex = 15
Top = 660
Width = 795
End
Begin VB.Label Label2
Caption = "性 别"
Height = 255
Left = 2700
TabIndex = 14
Top = 240
Width = 495
End
Begin VB.Label Label1
Caption = "姓 名"
Height = 255
Left = 240
TabIndex = 13
Top = 180
Width = 495
End
Begin VB.Label Label10
Caption = "简历"
Height = 195
Left = 180
TabIndex = 12
Top = 2760
Width = 675
End
End
Attribute VB_Name = "Frm_editgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo myerr
If Trim(Text1) = "" Then
MsgBox "姓名不能为空!", vbExclamation, "提示"
Exit Sub
End If
If Trim(Combo1) = "" Then
MsgBox "性别不能为空!", vbExclamation, "提示"
Exit Sub
End If
If Trim(Combo2) = "" Then
MsgBox "文化程度不能为空!", vbExclamation, "提示"
Exit Sub
End If
If Trim(Text1) = "" Then
MsgBox "政治面貌不能为空!", vbExclamation, "提示"
Exit Sub
End If
If Trim(Text1) = "" Then
MsgBox "技术职称不能为空!", vbExclamation, "提示"
Exit Sub
End If
If Len(Text1) > 8 Then
MsgBox "姓名超长", vbExclamation, "提示"
Text1.SetFocus
Exit Sub
End If
Dim cn As ADODB.Connection
Dim rst As New ADODB.Recordset
msg = MsgBox("是否保存修改?", vbYesNo + vbQuestion, "提示")
If msg = vbNo Then Exit Sub
Set cn = GetCn
If Trim(Text1) <> Frm_rcgl.ListView1.SelectedItem.Text Then
rst.Open "select * from 技术人才数据表 where 姓名='" & Text1 & "'", cn, 0, 1
If Not (rst.BOF And rst.EOF) Then msg = MsgBox("该姓名已存在,是否继续?", vbYesNo + vbQuestion, "提示")
If msg = vbNo Then
Text1.SetFocus
rst.Close
cn.Close
Exit Sub
End If
rst.Close
End If
cn.Execute "update 管理人才数据表 set 姓名='" & Trim(Text1) & "',性别='" & Trim(Combo1) & "',出生日期='" & DTPicker1.Value & "',文化程度='" & Trim(Combo2) & "',政治面貌='" & Trim(Combo3) & "',技术职称='" & Trim(Combo4) & "',家庭住址='" & Trim(Text2) & "',类别='" & Trim(Text3) & "',简历='" & Trim(Text4) & "' where id=" & Frm_rcgl.ListView1.SelectedItem.SubItems(9)
MsgBox "已成功修改!", vbExclamation, "提示"
cn.Close
Frm_rcgl.ListView1.SelectedItem.Text = Text1
Frm_rcgl.ListView1.SelectedItem.SubItems(1) = Combo1
Frm_rcgl.ListView1.SelectedItem.SubItems(2) = DTPicker1.Value
Frm_rcgl.ListView1.SelectedItem.SubItems(3) = Combo2
Frm_rcgl.ListView1.SelectedItem.SubItems(4) = Combo3
Frm_rcgl.ListView1.SelectedItem.SubItems(5) = Combo4
Frm_rcgl.ListView1.SelectedItem.SubItems(6) = Text2
Frm_rcgl.ListView1.SelectedItem.SubItems(7) = Text3
Frm_rcgl.ListView1.SelectedItem.SubItems(8) = Text4
' Frm_rcgl.ListView1.SelectedItem.SubItems(9) = Text5
Unload Me
Exit Sub
myerr:
MsgBox Error, vbExclamation, "提示"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Combo1.AddItem "男"
Combo1.AddItem "女"
Combo2.AddItem "高中"
Combo2.AddItem "大专"
Combo2.AddItem "大本"
Combo2.AddItem "硕士"
Combo2.AddItem "博士"
Combo3.AddItem "群众"
Combo3.AddItem "团员"
Combo3.AddItem "党员"
Combo4.AddItem "技工"
Combo4.AddItem "技术员"
Combo4.AddItem "工程师"
Text1 = Frm_rcgl.ListView1.SelectedItem.Text
Combo1 = Frm_rcgl.ListView1.SelectedItem.SubItems(1)
DTPicker1.Value = Frm_rcgl.ListView1.SelectedItem.SubItems(2)
Combo2 = Frm_rcgl.ListView1.SelectedItem.SubItems(3)
Combo3 = Frm_rcgl.ListView1.SelectedItem.SubItems(4)
Combo4 = Frm_rcgl.ListView1.SelectedItem.SubItems(5)
Text2 = Frm_rcgl.ListView1.SelectedItem.SubItems(6)
Text3 = Frm_rcgl.ListView1.SelectedItem.SubItems(7)
Text4 = Frm_rcgl.ListView1.SelectedItem.SubItems(8)
' Text5 = Frm_rcgl.ListView1.SelectedItem.SubItems(9)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -