Charlie.
Not advanced here. I'm a truck driver who does this on the side for extra cash. If you do not want to learn, please note that in your original post.<pre>
Private Sub cmdStart_Click()
'Declare storage space
Dim MyVal(2) As Integer
'Invite user to input numbers
MyVal(0) = Val(InputBox("Please enter number ", "INTEGER"))
MyVal(1) = Val(InputBox("Please enter second number ", "INTEGER"))
MyVal(2) = Val(InputBox("Please enter third number ", "INTEGER"))
'Message in picture box
picMessage.Print " The user has entered "; MyVal(0)
picMessage.Print "The user has enterd "; MyVal(1)
picMessage.Print "The user has entered "; MyVal(2)
picMessage.Print "The largest number entered is "; MaxVal(MyVal(0), MyVal(1), MyVal(2))
End Sub
Private Function MaxVal(ParamArray vals()) As Double
Dim ValCntr As Long, CheckVal As Double
CheckVal = vals(0)
For ValCntr = 0 To UBound(vals)
If Val(vals(ValCntr)) > CheckVal Then _
CheckVal = Val(vals(ValCntr))
Next
MaxVal = CheckVal
End Function</pre>
Re-usable code is the goal with object based programming and
you should spend the 15 or 20 minutes it would take to learn
to create a basic function. A function is pretty much the
same as a "Sub" except that it can return a value. You are
simply passing your arguments to the function, it does it's
thing, and returns the results. For more help, highlight
"Function", "ParamArray", "Ubound", ect... and press F1.
Tom
This message was edited by TsTom on 2002-10-11 06:14