📄 例6.2.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "找最高分和最低分"
ClientHeight = 1950
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 1950
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "查找"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1800
TabIndex = 1
Top = 1200
Width = 1095
End
Begin VB.Label Label1
Caption = "Label1"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 1080
TabIndex = 0
Top = 120
Width = 2655
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
Dim score As Variant
Private Sub Form_Load()
Label1.Caption = "单击“查找”按钮开始查找最高分和最低分"
score = Array(89, 96, 81, 67, 79, 90, 63, 85, 95, 83)
End Sub
Private Sub command1_click()
Dim max As Integer, min As Integer
max = score(1) '设定初值
min = score(1)
For i = 2 To 10
If max < score(i) Then '找最高分
max = score(i)
End If
If min > score(i) Then '找最低分
min = score(i)
End If
Next i
'Chr(13)起换行作用
Label1.Caption = "最高分:" + Str(max) + _
Chr(13) + "最低分:" + Str(min)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -