📄 frmteacheredit.frm
字号:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form frmTeacherEdit
BorderStyle = 1 'Fixed Single
Caption = "教师档案编辑"
ClientHeight = 6180
ClientLeft = 45
ClientTop = 330
ClientWidth = 10455
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6180
ScaleWidth = 10455
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 5760
TabIndex = 16
Top = 5520
Width = 1335
End
Begin VB.CommandButton btnOK
Caption = "确定"
Height = 375
Left = 2400
TabIndex = 15
Top = 5520
Width = 1335
End
Begin VB.Frame Frame1
Height = 4935
Left = 120
TabIndex = 0
Top = 120
Width = 10215
Begin RichTextLib.RichTextBox rtMemo
Height = 2655
Left = 7440
TabIndex = 26
Top = 480
Width = 2535
_ExtentX = 4471
_ExtentY = 4683
_Version = 393217
Enabled = -1 'True
TextRTF = $"frmTeacherEdit.frx":0000
End
Begin VB.TextBox txtPC
Alignment = 1 'Right Justify
Height = 300
Left = 1200
MaxLength = 15
TabIndex = 24
Top = 3360
Width = 2055
End
Begin VB.ComboBox cboDip
Height = 300
Left = 4200
Style = 2 'Dropdown List
TabIndex = 22
Top = 2040
Width = 2175
End
Begin VB.ComboBox cboSex
Height = 300
Left = 4200
Style = 2 'Dropdown List
TabIndex = 21
Top = 480
Width = 2175
End
Begin VB.TextBox txtIdendity
Alignment = 1 'Right Justify
Height = 300
Left = 1200
MaxLength = 15
TabIndex = 20
Top = 2040
Width = 2055
End
Begin VB.TextBox txtWork
Alignment = 1 'Right Justify
Height = 300
Left = 1200
MaxLength = 15
TabIndex = 18
Top = 2760
Width = 2055
End
Begin VB.TextBox txtBirth
Alignment = 1 'Right Justify
Height = 300
Left = 4200
MaxLength = 15
TabIndex = 14
Top = 1320
Width = 2175
End
Begin VB.TextBox txtTel
Alignment = 1 'Right Justify
Height = 300
Left = 4200
MaxLength = 15
TabIndex = 11
Top = 3360
Width = 2175
End
Begin VB.TextBox txtAdress
Alignment = 1 'Right Justify
Height = 300
Left = 1200
MaxLength = 15
TabIndex = 9
Top = 4080
Width = 2055
End
Begin VB.TextBox txtNation
Alignment = 1 'Right Justify
Height = 300
Left = 4200
MaxLength = 15
TabIndex = 7
Top = 2760
Width = 2175
End
Begin VB.TextBox txtWage
Alignment = 1 'Right Justify
Height = 300
Left = 1200
MaxLength = 15
TabIndex = 5
Top = 1320
Width = 2055
End
Begin VB.TextBox txtName
Alignment = 1 'Right Justify
Height = 300
Left = 1200
MaxLength = 15
TabIndex = 3
Top = 480
Width = 2055
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "备注"
Height = 180
Left = 6840
TabIndex = 25
Top = 480
Width = 360
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "邮政编码"
Height = 180
Left = 360
TabIndex = 23
Top = 3360
Width = 720
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "教师工号"
Height = 180
Left = 360
TabIndex = 19
Top = 2040
Width = 720
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "教师职务"
Height = 180
Left = 360
TabIndex = 17
Top = 2760
Width = 720
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "教师学历"
Height = 180
Left = 3360
TabIndex = 13
Top = 2040
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "出生日期"
Height = 180
Left = 3360
TabIndex = 12
Top = 1320
Width = 720
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "教师电话"
Height = 180
Left = 3360
TabIndex = 10
Top = 3480
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "居住地址"
Height = 180
Left = 360
TabIndex = 8
Top = 4080
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "教师籍贯"
Height = 180
Left = 3360
TabIndex = 6
Top = 2760
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "教师工龄"
Height = 180
Left = 360
TabIndex = 4
Top = 1320
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "性别"
Height = 180
Left = 3480
TabIndex = 2
Top = 600
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "教师姓名"
Height = 180
Left = 360
TabIndex = 1
Top = 600
Width = 720
End
End
End
Attribute VB_Name = "frmTeacherEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public modify As Boolean
Private Sub btnOK_Click()
If Len(Trim(txtName.Text)) = 0 Then
MsgBox "必须填入教师姓名!", vbExclamation
txtName.SetFocus
Exit Sub
End If
If Len(Trim(txtWage.Text)) = 0 Then
MsgBox "必须输入教师教龄!", vbExclamation
txtWage.SetFocus
Exit Sub
End If
If Len(Trim(txtBirth.Text)) = 0 Then
MsgBox "必须输如出生日期!", vbExclamation
txtBirth.SetFocus
Exit Sub
ElseIf IsDate(Trim(txtBirth.Text)) = False Then
MsgBox "请输入正确的日期格式!", vbExclamation
txtBirth.SetFocus
Exit Sub
End If
If Len(Trim(txtIdendity.Text)) = 0 Then
MsgBox "必须输入教师工号!", vbExclamation
txtIdendity.SetFocus
Exit Sub
End If
If Len(Trim(txtNation.Text)) = 0 Then
MsgBox "必须输入教师籍贯!", vbExclamation
txtNation.SetFocus
Exit Sub
End If
With MyTeacher
.Teacher_Name = MakeStr(txtName.Text)
.sex = MakeStr(cboSex.Text)
.Id_Card = MakeStr(txtIdendity.Text)
.Workage = MakeStr(txtWage.Text)
.Teacher_Dip = MakeStr(cboDip.Text)
.Phone = MakeStr(txtTel.Text)
.Family_Place = MakeStr(txtAdress.Text)
.Birth = txtBirth.Text
.Title = MakeStr(txtWork.Text)
.Nationality = MakeStr(txtNation.Text)
.PostCode = MakeStr(txtPC.Text)
.Memo = MakeStr(rtMemo.Text)
End With
If modify = False Then
'添加教师记录
'判断身份证号是否已经存在
If MyTeacher.Teacher_In_DB(Trim(txtIdendity.Text)) = True Then
MsgBox "已存在的教师工号!", vbExclamation
txtIdendity.SetFocus
Exit Sub
End If
'执行添加
MyTeacher.Insert
MsgBox "添加教师信息成功!", vbInformation
'刷新datagrid中的数据
Call frmTeacher.Refresh_Datagrid
Unload Me
Else
'更新教师记录
MyTeacher.Update (CurTeacher.Teacher_Id)
MsgBox "更新教师信息成功!", vbInformation
'刷新datagrid中的数据
Call frmTeacher.Refresh_Datagrid
Unload Me
End If
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub Form_Load()
cboSex.AddItem ("男")
cboSex.AddItem ("女")
cboSex.ListIndex = 0
cboDip.AddItem ("专科")
cboDip.AddItem ("本科")
cboDip.AddItem ("硕士")
cboDip.AddItem ("博士")
cboDip.ListIndex = 0
If modify = True Then
txtIdendity.Enabled = False
End If
End Sub
Private Sub Check()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -