Senin, 10 April 2017

Contoh Penggunaan Function pada Visual Studio 2015



KODINGNYA :

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Button1.Text = "Tekan"
        Me.ListBox1.Text = ""
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim na As Integer
        Dim nama As String
        nama = InputBox("Nama anda siapa")
        na = InputBox("Nilai dalam bentuk angka")
        ListBox1.Items.Add(nama)
        ListBox1.Items.Add("Hasil anda adalah")
        ListBox1.Items.Add(kelulusan(na))
        ListBox1.Items.Add("----------")
    End Sub
    Function kelulusan(ByVal nilai As Integer)
        If nilai >= 55 Then
            kelulusan = "LULUS"
        Else
            kelulusan = "GAGAL"
        End If
    End Function
End Class


0 komentar:

Posting Komentar