' Basic Programming ' Ch. 6 Demo Program #9 ' by Mr. Minich ' purpose - to illustrate the use of a general function to find the largest value in an array ' Ch. 6 Demo 9
Option Explicit
Private Sub cmdClick_Click()
Dim J As Integer
Dim intArray(9) As Integer
For J = 0 To 9
intArray(J) = InputBox("Enter an integer:")
Next J
lblOutput.Caption = intFindMax(intArray)
End Sub
Private Function intFindMax(intArray() As Integer)
Dim J As Integer
Dim intMax As Integer
intMax = intArray(0)
For J = 1 To 9
If (intArray(J) > intMax) Then
intMax = intArray(J)
End If
Next J
intFindMax = intMax
End Function