www.pudn.com > myActivebart.rar > grade.frm
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form5
Caption = "编辑学生成绩"
ClientHeight = 5940
ClientLeft = 60
ClientTop = 345
ClientWidth = 9105
Icon = "grade.frx":0000
LinkTopic = "Form5"
ScaleHeight = 5940
ScaleWidth = 9105
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Caption = "编辑成绩"
Height = 4095
Left = 6780
TabIndex = 14
Top = 1050
Width = 1995
Begin VB.TextBox Text2
BeginProperty DataFormat
Type = 1
Format = "###.##"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
Height = 315
Left = 750
MaxLength = 6
TabIndex = 15
Top = 330
Width = 1185
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "输入成绩按回车键,自动跳到下一行输入"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 840
Left = 630
TabIndex = 17
Top = 3030
Width = 1155
WordWrap = -1 'True
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "成绩:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 120
TabIndex = 16
Top = 390
Width = 570
End
End
Begin MSFlexGridLib.MSFlexGrid grid1
Height = 4095
Left = 180
TabIndex = 13
Top = 1080
Width = 6555
_ExtentX = 11562
_ExtentY = 7223
_Version = 393216
Rows = 150
Cols = 3
FixedCols = 0
BackColor = -2147483624
FocusRect = 2
HighLight = 2
FormatString = " 学号 | 姓名 | 成绩 "
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 405
Left = 7470
TabIndex = 12
Top = 450
Width = 1245
End
Begin VB.TextBox Text1
Height = 345
Left = 900
TabIndex = 11
Top = 570
Width = 1245
End
Begin VB.ComboBox Combo5
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
ItemData = "grade.frx":08CA
Left = 2820
List = "grade.frx":08D4
TabIndex = 9
Top = 570
Width = 735
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "grade.frx":08DE
Left = 5220
List = "grade.frx":08E8
TabIndex = 8
Top = 540
Width = 1905
End
Begin VB.CommandButton Command2
Caption = "保存(&S)"
Height = 375
Left = 7230
TabIndex = 6
Top = 5490
Width = 975
End
Begin VB.CommandButton Command3
Caption = "退出(&Q)"
Height = 375
Left = 8190
TabIndex = 5
Top = 5490
Width = 885
End
Begin VB.ComboBox Combo2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 5250
TabIndex = 2
Top = 120
Width = 1845
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1350
TabIndex = 0
Top = 150
Width = 2205
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "学期:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 2280
TabIndex = 10
Top = 630
Width = 570
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "考试类型:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 4110
TabIndex = 7
Top = 600
Width = 1020
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "学年:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 240
TabIndex = 4
Top = 630
Width = 570
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "选择科目:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 4080
TabIndex = 3
Top = 180
Width = 1020
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "选择班级:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 270
TabIndex = 1
Top = 210
Width = 1020
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As New ADODB.Recordset
Dim gridrow As Integer
Private Sub Command1_Click()
If rs.State = 1 Then rs.Close
rs.Open "select 学号,姓名 from 基本表 where 班级='" & Combo1.Text & "'"
Call grade(rs, grid1)
grid1.Col = 2
grid1.Row = 1
Text2.SetFocus
End Sub
Private Sub Command2_Click()
Dim i As Integer
If MsgBox("您确定要保存吗?", vbYesNo + vbQuestion, "提示") = vbYes Then
If rs.State = 1 Then rs.Close
rs.Open "select * from 学生在校成绩", cnn, adOpenKeyset, adLockPessimistic
i = 1
grid1.Row = i
Do While grid1.Text <> ""
rs.AddNew
rs.Fields("班级") = Combo1.Text
rs.Fields("科目") = Combo2.Text
rs.Fields("学年度") = Text1.Text
rs.Fields("学期") = Combo5.Text
rs.Fields("考试类型") = Combo3.Text
grid1.Col = 0
rs.Fields("学号") = grid1.Text
grid1.Col = 1
rs.Fields("姓名") = grid1.Text
grid1.Col = 2
rs.Fields("成绩") = grid1.Text
rs.Update
i = i + 1
grid1.Row = i
Loop
End If
End Sub
Private Sub Command3_Click()
Unload Form5
End Sub
Private Sub Command4_Click()
Text1.Top = grid1.CellTop
End Sub
Private Sub Form_Load()
If rs.State = 1 Then rs.Close
rs.Open "select 班级 from 班级表", cnn, adOpenKeyset, adLockPessimistic
If rs.RecordCount <> 0 Then
Combo1.Clear
Do While Not rs.EOF
Combo1.additem rs.Fields("班级")
rs.MoveNext
Loop
End If
If rs.State = 1 Then rs.Close
rs.Open "select 科目 from 科目表", cnn, adOpenKeyset, adLockPessimistic
If rs.RecordCount <> 0 Then
Combo2.Clear
Do While Not rs.EOF
Combo2.additem rs.Fields("科目")
rs.MoveNext
Loop
End If
gridrow = 1
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = 13 Then
grid1.Col = 2
grid1.Text = Text2.Text
gridrow = gridrow + 1
grid1.Row = gridrow
Text2.Text = ""
Text2.SetFocus
End If
End Sub