📄 frmaddstudent.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form FrmAddStudent
Caption = "输入学生资料"
ClientHeight = 7770
ClientLeft = 60
ClientTop = 390
ClientWidth = 7530
LinkTopic = "Form1"
ScaleHeight = 7770
ScaleWidth = 7530
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "个人信息"
Height = 6735
Left = 120
TabIndex = 3
Top = 120
Width = 7095
Begin VB.TextBox txtID
Height = 285
Left = 1155
TabIndex = 16
Top = 345
Width = 1650
End
Begin VB.TextBox txtName
Height = 285
Left = 1155
TabIndex = 15
Top = 720
Width = 1650
End
Begin VB.TextBox txtDepartment
Height = 285
Left = 1155
TabIndex = 14
Top = 1125
Width = 1650
End
Begin VB.TextBox txtClass
Height = 285
Left = 4755
TabIndex = 13
Top = 1140
Width = 1650
End
Begin VB.TextBox txtNative
Height = 285
Left = 1155
TabIndex = 12
Top = 2145
Width = 1695
End
Begin VB.TextBox txtPhone
Height = 285
Left = 1155
TabIndex = 11
Top = 2640
Width = 1740
End
Begin VB.TextBox txtAddress
Height = 285
Left = 1155
TabIndex = 10
Top = 3270
Width = 5295
End
Begin VB.TextBox txtZipCode
Height = 285
Left = 4755
TabIndex = 9
Top = 2685
Width = 1680
End
Begin VB.TextBox txtEmail
Height = 285
Left = 1155
TabIndex = 8
Top = 3780
Width = 5295
End
Begin VB.Frame Frame2
Caption = "备注"
Height = 2175
Left = 480
TabIndex = 6
Top = 4320
Width = 6255
Begin VB.TextBox txtMemo
Height = 1575
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 7
Top = 360
Width = 5775
End
End
Begin VB.ComboBox cmbSex
Height = 300
ItemData = "FrmAddStudent.frx":0000
Left = 1200
List = "FrmAddStudent.frx":000A
TabIndex = 5
Text = "男"
Top = 1560
Width = 855
End
Begin MSComCtl2.DTPicker DtpBirthday
Bindings = "FrmAddStudent.frx":0016
Height = 285
Left = 4800
TabIndex = 4
Top = 2160
Width = 1695
_ExtentX = 2990
_ExtentY = 503
_Version = 393216
Format = 19791873
CurrentDate = 39658
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "学号:"
Height = 255
Index = 0
Left = 150
TabIndex = 28
Top = 390
Width = 975
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "姓名:"
Height = 255
Index = 1
Left = 270
TabIndex = 27
Top = 765
Width = 855
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "性别:"
Height = 255
Index = 2
Left = 390
TabIndex = 26
Top = 1635
Width = 735
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "系别:"
Height = 180
Index = 3
Left = 675
TabIndex = 25
Top = 1170
Width = 450
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "班级:"
Height = 255
Index = 4
Left = 3990
TabIndex = 24
Top = 1185
Width = 735
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "生日:"
Height = 180
Index = 5
Left = 4275
TabIndex = 23
Top = 2175
Width = 450
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "籍贯:"
Height = 255
Index = 6
Left = 390
TabIndex = 22
Top = 2190
Width = 735
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "电话:"
Height = 255
Index = 7
Left = 240
TabIndex = 21
Top = 2685
Width = 855
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "住址:"
Height = 180
Index = 8
Left = 675
TabIndex = 20
Top = 3315
Width = 450
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "邮编:"
Height = 255
Index = 9
Left = 3990
TabIndex = 19
Top = 2730
Width = 735
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "E-MAIL:"
Height = 180
Index = 10
Left = 465
TabIndex = 18
Top = 3825
Width = 630
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Height = 180
Index = 11
Left = 1035
TabIndex = 17
Top = 4575
Width = 90
End
End
Begin VB.CommandButton cmdReset
Caption = "清空所有"
Height = 375
Left = 1800
TabIndex = 2
Top = 7200
Width = 1215
End
Begin VB.CommandButton cmdOk
Caption = "确定"
Height = 375
Left = 3600
TabIndex = 1
Top = 7200
Width = 975
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 5160
TabIndex = 0
Top = 7200
Width = 975
End
Begin VB.Menu mnuAdd
Caption = ""
Visible = 0 'False
Begin VB.Menu mnuChange
Caption = "输入学籍变更资料"
End
Begin VB.Menu mnuReward
Caption = "输入奖励情况"
End
Begin VB.Menu mnuPunish
Caption = "输入处罚情况"
End
End
End
Attribute VB_Name = "FrmAddStudent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public strStuNo As String ' 当前记录的学号
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdReset_Click()
reset
End Sub
' 窗体加载时初始化连接设置
Private Sub Form_Load()
cnn.Open strCnn
End Sub
' 退出当前窗体时,关闭及释放连接
Private Sub Form_Unload(Cancel As Integer)
If cnn.State = adStateOpen Then
cnn.Close
Set cnn = Nothing
End If
End Sub
Private Sub Append() '添加记录子函数
On Error GoTo ErrHandle
Dim Rs As New Recordset
Dim cmd As New ADODB.Command
cmd.ActiveConnection = cnn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "stu_AddBasicStudentInfo"
cmd.Parameters.Append cmd.CreateParameter("@studentNo", adChar, adParamInput, 6)
cmd.Parameters.Append cmd.CreateParameter("@name", adVarChar, adParamInput, 20)
cmd.Parameters.Append cmd.CreateParameter("@sex", adChar, adParamInput, 2)
cmd.Parameters.Append cmd.CreateParameter("@departName", adVarChar, adParamInput, 50)
cmd.Parameters.Append cmd.CreateParameter("@className", adVarChar, adParamInput, 50)
cmd.Parameters.Append cmd.CreateParameter("@birthday", adDate, adParamInput)
cmd.Parameters.Append cmd.CreateParameter("@native", adVarChar, adParamInput, 50)
cmd.Parameters.Append cmd.CreateParameter("@phone", adChar, adParamInput, 20)
cmd.Parameters.Append cmd.CreateParameter("@address", adVarChar, adParamInput, 100)
cmd.Parameters.Append cmd.CreateParameter("@zipCode", adChar, adParamInput, 8)
cmd.Parameters.Append cmd.CreateParameter("@email", adVarChar, adParamInput, 50)
cmd.Parameters.Append cmd.CreateParameter("@memo", adVarChar, adParamInput, 1000)
cmd.Parameters.Refresh
cmd.Parameters(1).Value = txtID.Text
cmd.Parameters(2).Value = txtName.Text
cmd.Parameters(3).Value = cmbSex.Text
cmd.Parameters(4).Value = txtDepartment.Text
cmd.Parameters(5).Value = txtClass.Text
cmd.Parameters(6).Value = DtpBirthday.Value
cmd.Parameters(7).Value = txtNative.Text
cmd.Parameters(8).Value = txtPhone.Text
cmd.Parameters(9).Value = txtAddress.Text
cmd.Parameters(10).Value = txtZipCode.Text
cmd.Parameters(11).Value = txtEmail.Text
cmd.Parameters(12).Value = txtMemo.Text
Set Rs.Source = cmd
Rs.Open
Set Rs = cmd.Execute()
MsgBox "添加成功!"
Exit Sub
ErrHandle:
MsgBox Err.Description
End Sub
'清空所有内容函数
Private Sub reset()
txtID.Text = ""
txtName.Text = ""
cmbSex.Text = "男"
txtDepartment.Text = ""
txtClass.Text = ""
txtNative.Text = ""
txtPhone.Text = ""
txtAddress.Text = ""
txtZipCode = ""
txtEmail.Text = ""
txtMemo.Text = ""
End Sub
'响应添加命令
Private Sub cmdok_Click()
Append
End Sub
'实现快捷菜单弹出功能
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
' 添加快捷菜单
FrmAddStudent.PopupMenu mnuAdd, 0, X, Y
End If
End Sub
Private Sub Frame1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
FrmAddStudent.PopupMenu mnuAdd, 0, X, Y
End If
End Sub
' 弹出学生学籍变更管理窗口
Private Sub mnuChange_Click()
'MsgBox "当前记录学号为"
If Trim(txtID.Text) <> "" Then
FrmAddChange.strStuNo = Trim(txtID.Text)
FrmAddChange.Show vbModal
End If
End Sub
' 弹出学生处罚信息管理窗口
Private Sub mnuPunish_Click()
'MsgBox "当前记录学号为"
If Trim(txtID.Text) <> "" Then
FrmAddPunish.strStuNo = Trim(txtID.Text)
FrmAddPunish.Show vbModal
End If
End Sub
' 弹出学生奖励信息管理窗口
Private Sub mnuReward_Click()
'MsgBox "当前记录学号为"
If Trim(txtID.Text) <> "" Then
FrmAddReward.strStuNo = Trim(txtID.Text)
FrmAddReward.Show vbModal
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -