📄 v6j05-05.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "最高"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 3
Left = 3240
TabIndex = 10
Top = 2640
Width = 855
End
Begin VB.CommandButton Command1
Caption = "新增"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 0
Left = 480
TabIndex = 9
Top = 2640
Width = 855
End
Begin VB.CommandButton Command1
Caption = "后一个"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 2
Left = 2280
TabIndex = 8
Top = 2640
Width = 855
End
Begin VB.CommandButton Command1
Caption = "前一个"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 1
Left = 1440
TabIndex = 7
Top = 2640
Width = 735
End
Begin VB.TextBox Text3
Height = 495
Left = 1680
TabIndex = 5
Top = 1560
Width = 1215
End
Begin VB.TextBox Text2
Height = 495
Left = 1680
TabIndex = 4
Top = 960
Width = 1215
End
Begin VB.TextBox Text1
Height = 495
Left = 1680
TabIndex = 3
Top = 240
Width = 1215
End
Begin VB.Label Label5
Height = 375
Left = 1440
TabIndex = 11
Top = 2280
Width = 495
End
Begin VB.Label Label4
Caption = "位置"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 6
Top = 2280
Width = 615
End
Begin VB.Label Label3
Caption = "总分"
Height = 375
Left = 600
TabIndex = 2
Top = 1560
Width = 855
End
Begin VB.Label Label2
Caption = "专业"
Height = 375
Left = 600
TabIndex = 1
Top = 960
Width = 615
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "姓名"
Height = 375
Left = 480
TabIndex = 0
Top = 360
Width = 855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 1
'Private Sub Command1_Click()
' Dim s1(1 To 10) As StudType, Maxs As StudType
' For i = 1 To 10 '输入10个学生的学号、总分
' s1(i).No = InputBox("输入学号")
' s1(i).Total = InputBox("输入分数")
' Next i
' Maxs = s1(1) '假定第1个学生为最高分
' For i = 2 To 10 '逐一与最高分比较,若高,则替换为最高分
' If s1(i).Total > Maxs.Total Then Maxs = s1(i)
' Next i
' Print Maxs.No, Maxs.Total '显示最高分的学号和总分
'End Sub
Dim n%, i%
Dim stud(1 To 100) As StudType
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0 '新增
If n < 100 Then
n = n + 1
Else
MsgBox "输入人数超过数组声明的个数"
End
End If
i = i + 1
With stud(n)
.Name = Text1
.Special = Text2
.Total = Val(Text3)
End With
Text1 = ""
Text2 = ""
Text3 = 0
Case 1 '前一条
If i > 1 Then i = i - 1
With stud(i)
Text1 = .Name
Text2 = .Special
Text3 = .Total
End With
Case 2 '后一条
If i < n Then i = i + 1
With stud(i)
Text1 = .Name
Text2 = .Special
Text3 = .Total
End With
Case 3 '找最高分者
Max = stud(1).Total
maxi = 1
For j = 2 To n
If stud(j).Total > Max Then
Max = stud(j).Total
maxi = j
End If
Next j
With stud(maxi)
Text1 = .Name
Text2 = .Special
Text3 = .Total
End With
i = maxi
End Select
Label5 = i & "/" & n '显示当前位置和总数
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -