<%@ Page Language="vb" %>
<HTML>
<HEAD>
<script language="vb" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myArray As Integer() = New Integer() {2, 4, 5, 6, 43, 432, 3, 94, 2}
Response.Write("Il valore più alto è: " & getMax(myArray))
End Sub
Private Function getMax(ByVal myArray As Integer()) As Integer
Dim massimo As Integer = 0
Dim valore As Integer
For Each valore In myArray
If valore > massimo Then
massimo = valore
End If
Next
Return massimo
End Function
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
</form>
</body>
</HTML>