📄 6-4.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "学生成绩管理"
ClientHeight = 4575
ClientLeft = 45
ClientTop = 330
ClientWidth = 6630
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4575
ScaleWidth = 6630
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Exit
Caption = "退出"
Height = 375
Left = 5640
TabIndex = 4
Top = 4080
Width = 855
End
Begin VB.CommandButton Delete
Caption = "删除"
Height = 375
Left = 3800
TabIndex = 3
Top = 4080
Width = 855
End
Begin VB.CommandButton Add
Caption = "添加"
Height = 375
Left = 1960
TabIndex = 2
Top = 4080
Width = 855
End
Begin VB.CommandButton Find
Caption = "查询"
Height = 375
Left = 120
TabIndex = 1
Top = 4080
Width = 855
End
Begin MSFlexGridLib.MSFlexGrid Grid1
Height = 3975
Left = 0
TabIndex = 0
Top = 0
Width = 6615
_ExtentX = 11668
_ExtentY = 7011
_Version = 393216
Cols = 4
FixedCols = 0
GridLines = 2
ScrollBars = 2
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Find_Click()
'用于更新显示。
'通常由程序自动更新,不需按“查询”按钮
Dim i As Integer
Dim MyObject As Student
OpenData '打开数据文件
Grid1.Rows = Students.Count + 1 '设置最大行数
i = 1
For Each MyObject In Students
'显示全部数据
With Grid1
.Row = i
.Col = 0
.Text = Str(MyObject.Number)
.Col = 1
.Text = MyObject.Names
.Col = 2
.Text = Str(MyObject.Chinese)
.Col = 3
.Text = Str(MyObject.Mathmatic)
i = i + 1
End With
Next
End Sub
Private Sub Add_Click()
FormAdd.Show 1 '增加记录
Find_Click '刷新显示
End Sub
Private Sub Delete_Click()
If Grid1.Rows < 2 Then
'无记录
Exit Sub
End If
Grid1.Col = 0
If MsgBox("是否确认删除" + Grid1.Text + " 号学生记录 ?", vbYesNo, "删除警告") = vbYes Then
Students.Remove Grid1.Row '删除当前行
SaveData '保存删除
Find_Click '刷新显示
End If
End Sub
Private Sub Exit_Click()
Unload Me
End Sub
Private Sub Form_Load()
'设置列宽
Grid1.ColWidth(0) = 1000
Grid1.ColWidth(1) = 2500
Grid1.ColWidth(2) = 1500
Grid1.ColWidth(3) = 1500
'设置列标题
Grid1.Row = 0
Grid1.Col = 0
Grid1.Text = " 学号"
Grid1.Col = 1
Grid1.Text = " 姓名"
Grid1.Col = 2
Grid1.Text = " 语文成绩"
Grid1.Col = 3
Grid1.Text = " 数学成绩"
Grid1.Rows = 1
'Find_Click '更新显示
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -