Jumat, 28 Desember 2012

Overload


OVERLOAD

Buat  form seperti dibawah ini

 

















 masukkan codingnya :

 Function ox(ByVal bil1 As IntegerByVal bil2 As IntegerAs Integer
        ox = bil1 + bil2
    End Function

    Function ox(ByVal bil1 As IntegerByVal bil2 As IntegerByValbil3 As Integer
    As Integer
        ox = bil1 + bil2 + bil3
    End Function


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles Button1.Click
        TextBox1.Text = ox(31,8,92)
    End Sub

dan hasilnya adalah :


Read More...

Sabtu, 22 Desember 2012

Tugas 8 Pemrograman Visual



TUGAS 1

Membuat form seperti di bawah ini






Kemudian masukkan codingnya :

Public Class Form2

    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(1, 6, 2, 7, 3, 9, 4, 10, 8, 5)
        TextBox1.Text = statistik(0)
        TextBox3.Text = statistik(1)
        TextBox2.Text = statistik(2)
    End Sub
End Class 



Dan hasilnya adalah
























Keterangan :

Dalam coding di latihan adalah :
Dim statistik As Single() = fstat(1, 6, 2, 7, 3, 9, 4, 10, 8, 5)
TextBox1.Text = statistik(0)
TextBox2.Text = statistik(1)
TextBox3.Text = statistik(2)

Dan kemudian diperbaharui menjadi :
Dim statistik As Single() = fstat(1, 6, 2, 7, 3, 9, 4, 10, 8, 5)
TextBox1.Text = statistik(0)
TextBox3.Text = statistik(1)
TextBox2.Text = statistik(2)



 
Read More...