📄 frmstuedit.frm
字号:
Begin VB.Label Label4
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "入校日期"
Height = 180
Left = 3360
TabIndex = 18
Top = 2088
Width = 720
End
Begin VB.Label Label11
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "家庭电话"
Height = 180
Left = 6120
TabIndex = 17
Top = 1656
Width = 720
End
Begin VB.Label Label25
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "籍贯"
Height = 180
Left = 3360
TabIndex = 16
Top = 792
Width = 360
End
Begin VB.Label Label6
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "性别"
Height = 180
Left = 3360
TabIndex = 15
Top = 360
Width = 360
End
Begin VB.Label Label21
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "学生证号"
Height = 180
Left = 6120
TabIndex = 14
Top = 1224
Width = 720
End
End
End
Attribute VB_Name = "FrmStuEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public modify As Boolean
Private Sub Cmd_Cancel_Click()
FrmStuMan.TmpOk = False
Unload Me
End Sub
Private Sub Cmd_OK_Click()
If Len(Trim(txtStu_Name.Text)) = 0 Then
MsgBox "学生姓名不能为空!", vbExclamation
txtStu_Name.SetFocus
Exit Sub
End If
If Len(Trim(txtNationality.Text)) = 0 Then
MsgBox "民族不能为空!", vbExclamation
txtNationality.SetFocus
Exit Sub
End If
If Len(Trim(txtFamily_Place.Text)) = 0 Then
MsgBox "籍贯不能为空!", vbExclamation
txtFamily_Place.SetFocus
Exit Sub
End If
If Len(Trim(txtBirth.Text)) = 0 Then
MsgBox "出生日期不能为空!", vbExclamation
txtBirth.SetFocus
Exit Sub
End If
If Len(Trim(txtBadgeID.Text)) = 0 Then
MsgBox "学生证号不能为空!", vbExclamation
txtBadgeID.SetFocus
Exit Sub
End If
With MyStu
'姓名
.Student_Name = MakeStr(txtStu_Name)
'性别
.sex = ComboSex.Text
'民族
.Nationality = MakeStr(txtNationality)
'生日
If IsDate(txtBirth.Text) = False Then
MsgBox "请选择正确的出生日期"
Exit Sub
End If
.Birth = Trim(txtBirth.Text)
'籍贯
.Family_Place = MakeStr(txtFamily_Place)
'身份证号
.Id_Card = MakeStr(txtId_Card)
'学生证号
.BadgeID = MakeStr(txtBadgeID)
'家庭电话
.Home_phone = MakeStr(txtHomePhone)
'居住地址
.Residence = MakeStr(txtResidence)
'邮政编号
.PostCode = MakeStr(txtPostcode)
'入校日期
If IsDate(txtInDate.Text) = False Then
MsgBox "请选择正确的入校日期"
Exit Sub
End If
.InDate = Trim(txtInDate.Text)
'职务
.Title = MakeStr(txtTitle)
'备注
.Memo = MakeStr(txtMemo)
'填表时间
dd = Date
dd = Format(dd, "yyyy-mm-dd")
t = Time
tt = Trim(Str(Hour(t))) + ":" + Trim(Str(Minute(t))) + ":" + Trim(Str(Second(t)))
.Fillin_Time = dd + " " + tt
'院系班级编号
.Class_Id = CurClass.Class_Id
'根据变量Modify,判断是插入新数据,还是修改已有的数据
If modify = False Then
'判断学号是否存在
If MyStu.GetStuId(MakeStr(txtBadgeID.Text)) = True Then
.Insert
MsgBox "添加成功!", vbInformation
Else
MsgBox "该学号学生已经存在!", vbExclamation
Exit Sub
End If
Else
.Update (CurStu.Student_Id)
End If
FrmStuMan.TreeView1_Click
End With
'设置学生管理窗体中的状态标识
FrmStuMan.TmpOk = True
Unload Me
End Sub
Private Sub Form_Load()
If modify = False Then
txtStu_Name = ""
ComboSex.ListIndex = 0
txtNationality = ""
txtBirth.Text = ""
txtFamily_Place = ""
txtId_Card = ""
txtBadgeID = ""
txtHomePhone = ""
txtResidence = ""
txtPostcode = ""
txtInDate.Text = ""
txtTitle = ""
txtMemo = ""
Else
txtBadgeID.Enabled = False
With CurStu
'姓名
txtStu_Name = .Student_Name
'性别
If InCombo(.sex, ComboSex) = True Then
ComboSex.Text = .sex
End If
'民族
txtNationality = .Nationality
'生日
txtBirth.Text = .Birth
'籍贯
txtFamily_Place = .Family_Place
'身份证
txtId_Card = .Id_Card
'学生证
txtBadgeID = .BadgeID
'家庭电话
txtHomePhone = .Home_phone
'家庭住址
txtResidence = .Residence
'邮政编码
txtPostcode = .PostCode
'入校时间
txtInDate.Text = .InDate
'职务
txtTitle = .Title
'备注
txtMemo = .Memo
End With
End If
End Sub
Private Sub txtBadgeID_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtStu_Name_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtFamily_Place_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtHomePhone_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtId_Card_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtMemo_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtNationality_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtPostcode_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtResidence_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtTitle_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -