Option Base 1
Private Sub Form_KeyPress(KeyAscii As Integer)
'程序功能,当按下enter键时输出数组a的值,及其在数组中的位置
'当按下其他键时,输出数组a的第一个元素,及其对应的下标1
'在本题中由于按下了enter键,所以输出数组a的最大值498,及其下标位置5
a = Array(237, 126, 87, 48, 498)
m1 = a(1)
m2 = 1
If KeyAscii = 13 Then
For i = 2 To 5
If a(i) > m1 Then
m1 = a(i)
m2 = i
End If
Next i
End If
Print m1
Print m2
End Sub