Contoh program Penerapan Function pada Microsoft Visual Studio 2010
Function dengan Microsoft Visual Studio 2010 A. FUNCTION DENGAN RETURN VALUE BERUPA ARRAY Desain form seperti dibawah ini: Public Class Form1 Private Function fstat(ByVal ParamArray args() As Object) As Single() Dim hasil(3) As Single Dim i As Integer For i = 0 To UBound(args) hasil(0) = hasil(0) + args(i) If i = 0 Then hasil(1) = args(i) hasil(2) = args(i) End If If hasil(1) > args(i) Then hasil(1) = args(i) If hasil(2) < args(i) Then hasil(2) = args(i) Next i Return hasil End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button1.Click Dim statistik As Single() = fstat(21, 30, 5, 19, 33, 89, 4) TextBox1.Text = statistik(0) TextBox2.Text = statistik(1) TextBox3.Text = statistik(2) End Sub End Class