📄 pshicj.frm
字号:
VERSION 5.00
Begin VB.Form pshiCj
BorderStyle = 3 'Fixed Dialog
Caption = "平时成绩"
ClientHeight = 3555
ClientLeft = 45
ClientTop = 435
ClientWidth = 4695
Icon = "pshiCj.frx":0000
LinkTopic = "Form3"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3555
ScaleWidth = 4695
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 600
TabIndex = 8
Top = 3120
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3000
TabIndex = 7
Top = 3120
Width = 1095
End
Begin VB.Frame Frame1
Height = 3015
Left = 0
TabIndex = 0
Top = 0
Width = 4815
Begin VB.Frame Frame4
Caption = "学期:"
Height = 615
Left = 120
TabIndex = 5
Top = 1200
Width = 2775
Begin VB.ComboBox Combo1
BackColor = &H80000018&
Height = 300
Index = 3
ItemData = "pshiCj.frx":08CA
Left = 600
List = "pshiCj.frx":08E6
TabIndex = 6
Text = "大一上学期"
Top = 180
Width = 2055
End
End
Begin VB.Frame Frame2
Caption = "学号:"
Height = 615
Left = 120
TabIndex = 3
Top = 120
Width = 2775
Begin VB.ComboBox Combo1
BackColor = &H80000018&
Height = 300
Index = 0
ItemData = "pshiCj.frx":094A
Left = 600
List = "pshiCj.frx":094C
Style = 2 'Dropdown List
TabIndex = 4
Top = 180
Width = 2055
End
End
Begin VB.Frame Frame5
Caption = "分数:"
Height = 615
Left = 120
TabIndex = 1
Top = 2280
Width = 2775
Begin VB.TextBox Text3
Appearance = 0 'Flat
BackColor = &H80000018&
Height = 320
Left = 600
TabIndex = 2
Top = 180
Width = 2020
End
End
Begin VB.Image Image1
Height = 2655
Left = 3240
Picture = "pshiCj.frx":094E
Stretch = -1 'True
Top = 240
Width = 1335
End
End
End
Attribute VB_Name = "pshiCj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Combo1(0).Text = "" Then
sss = MsgBox("学号不能为空!", vbExclamation + vbOKOnly, "警告")
Combo1(0).SetFocus
Exit Sub
End If
If Combo1(3).Text = "" Then
sss = MsgBox("学期不能为空!", vbExclamation + vbOKOnly, "警告")
Combo1(3).SetFocus
Exit Sub
End If
If Not Testtxt(Text3.Text) Then
MsgBox "还没有输入分数呢!!", vbOKOnly + vbExclamation, "警告"
Text3.SetFocus
Exit Sub
End If
If Not IsNumeric(Text3.Text) Then
MsgBox "分数必须输入数字!", vbOKOnly + vbExclamation, "警告"
Text3.Text = ""
Text3.SetFocus
Exit Sub
End If
Dim mrc As ADODB.Recordset
txtSQL = "select 学号 from pshicj where 学号='" & Trim(Combo1(0).Text) & "' and 学期='" & Trim(Combo1(3).Text) & "'"
Set mrc = ExecuteSQL(txtSQL)
If mrc.EOF = False Then
sss = MsgBox("已存在该学号的成绩记录!", vbExclamation + vbOKOnly, "警告")
Combo1(0).SetFocus
Exit Sub
End If
txtSQL = "select * from pshicj"
Set mrc = ExecuteSQL(txtSQL)
mrc.AddNew
mrc.Fields(1) = Combo1(0).Text
mrc.Fields(2) = Trim(Combo1(3).Text)
mrc.Fields(3) = Val(Trim(Text3.Text))
mrc.Update
Text3.Text = ""
Combo1(0).SetFocus
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim mrc As ADODB.Recordset
txtSQL = "select 学号 from stud"
Set mrc = ExecuteSQL(txtSQL)
If mrc.EOF = True Then
Exit Sub
End If
mrc.MoveFirst
Do Until mrc.EOF
Combo1(0).AddItem mrc.Fields(0)
mrc.MoveNext
Loop
Set mrc = Nothing
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmMain.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -