Selasa, 06 Mei 2014



UTS PEMROGRAMAN WEB


Dalam kesempatan ini saya ingin membuat aplikasi sederhana tentang nilai Mahasiswa. Dalam hal ini saya menggunakan metode if dan else. Seperti tampilan di bawah ini :





Adapun kodingannya adalah sebagai berikut :


Public Class Form1
    Private Sub txtnilai1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtnilai1.LostFocus
        Dim Mn1 As Double
        Mn1 = Val(txtnilai1.Text)
        If Mn1 >= 70 Then
            txtket.Text = "LULUS"
        Else
            txtnilai2.Visible = True
            txtrn.Visible = True
            txtnilai2.Focus()

        End If
    End Sub
    Private Sub txtnilai2_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtnilai2.LostFocus
        Dim Mn2 As Double
        Dim Mrt As Double
        Mn2 = Val(txtnilai2.Text)
        Mrt = (Val(txtnilai1.Text) + Mn2) / 2
        txtrn.Text = Mrt
        If Mrt >= 60 Then
            txtket.Text = "LULUS"
        Else
            txtket.Text = "GAGAL"

        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.Items.Add("LAKI-LAKI")
        ComboBox1.Items.Add("PEREMPUAN")
        txtrn.Enabled = False
        txtket.Enabled = False
    End Sub

    Private Sub btnselesai_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnselesai.Click
        Me.Close()
    End Sub
End Class