SpongeBob SquarePants Mr. Krabs

Minggu, 08 Desember 2013

latihan program nilai mahasiswa dengan menggunakan listview

ini dia form desain nya

nah , , ini programnya !

Public Class Form1
    Dim w As Byte
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        w = 1
        NPM.Items.Add("12110039")
        NPM.Items.Add("12120129")
        NPM.Items.Add("12130201")
        NPM.Items.Add("12120342")
        NPM.Items.Add("12110410")

        kddosen.Items.Add("lab06")
        kddosen.Items.Add("lab04")
        kddosen.Items.Add("lab05")

        kdmakul.Items.Add("M01")
        kdmakul.Items.Add("M02")
        kdmakul.Items.Add("M03")

        Dim x As Integer
        For x = 100 To 1 Step -3
            nkehadiran.Items.Add(x)
            ntugas.Items.Add(x)
            nUTS.Items.Add(x)
            nUAS.Items.Add(x)
        Next
        nakhir.Enabled = False
        nhuruf.Enabled = False
        keterangan.Enabled = False
    End Sub
    Sub jurjen()
        Dim jen = Microsoft.VisualBasic.Mid(NPM.Text, 3, 2)
        Dim jur = Microsoft.VisualBasic.Mid(NPM.Text, 5, 2)
        If jen = "11" Then
            jenjang.Text = "S1"
        ElseIf jen = "12" Then
            jenjang.Text = "D3"
        ElseIf jen = "13" Then
            jenjang.Text = "D1"
        End If
        If jur = "00" Then
            jurusan.Text = "Tehnik Informatika"
        ElseIf jur = "01" Then
            jurusan.Text = "Sistem Informatika"
        ElseIf jur = "02" Then
            jurusan.Text = "Manajemen Informatika"
        ElseIf jur = "03" Then
            jurusan.Text = "Komputerisasi Akuntansi"
        ElseIf jur = "04" Then
            jurusan.Text = "Desain Grafis"
        End If
    End Sub
    Private Sub NPM_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NPM.SelectedIndexChanged
        If NPM.Text = "12110039" Then
            nama.Text = "Abdul rahman anshari"
            Call jurjen()
        ElseIf NPM.Text = "12120129" Then
            nama.Text = "Mutia rizky"
            Call jurjen()
        ElseIf NPM.Text = "12130201" Then
            nama.Text = "Kiki kurnia"
            Call jurjen()
        ElseIf NPM.Text = "12120342" Then
            nama.Text = "Dharma yudistira"
            Call jurjen()
        ElseIf NPM.Text = "12110410" Then
            nama.Text = "verry zammesta"
            Call jurjen()
        End If
    End Sub
    Private Sub kddosen_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kddosen.SelectedIndexChanged
        If kddosen.Text = "lab06" Then
            namadosen.Text = "Mesran,M.Kom"
        ElseIf kddosen.Text = "lab04" Then
            namadosen.Text = "Toni limbong,M.Kom"
        ElseIf kddosen.Text = "lab05" Then
            namadosen.Text = "Kristian siregar,M.Kom"
        End If
    End Sub
    Private Sub kdmakul_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kdmakul.SelectedIndexChanged
        If kdmakul.Text = "M01" Then
            namamakul.Text = "Pemrograman Visual "
        ElseIf kdmakul.Text = "M02" Then
            namamakul.Text = "Konsep pemrograman"
        ElseIf kdmakul.Text = "M03" Then
            namamakul.Text = "Pemrograman HTML"
        End If
    End Sub
    Private Sub b_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bproses.Click
        nakhir.Text = 0.1 * nkehadiran.Text + 0.15 * ntugas.Text + 0.3 * nUTS.Text + 0.45 * nUAS.Text
        If nakhir.Text >= 90 Then
            nhuruf.Text = "A"
            keterangan.Text = "LULUS"
        ElseIf nakhir.Text >= 80 Then
            nhuruf.Text = "B"
            keterangan.Text = "LULUS"
        ElseIf nakhir.Text >= 70 Then
            nhuruf.Text = "C"
            keterangan.Text = "LULUS"
        ElseIf nakhir.Text >= 60 Then
            nhuruf.Text = "D"
            keterangan.Text = "LULUS"
        ElseIf nakhir.Text <= 50 Then
            nhuruf.Text = "E"
            keterangan.Text = "GAGAL"
        End If
    End Sub
    Sub bersih()
        NPM.Text = ""
        nama.Text = ""
        jenjang.Text = ""
        jurusan.Text = ""
        kddosen.Text = ""
        namadosen.Text = ""
        kdmakul.Text = ""
        namamakul.Text = ""
        nkehadiran.Text = ""
        ntugas.Text = ""
        nUTS.Text = ""
        nUAS.Text = ""
        nakhir.Text = ""
        nhuruf.Text = ""
        keterangan.Text = ""
        NPM.Focus()
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bhapus.Click
        bersih()
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bkeluar.Click
        Me.Close()
    End Sub
    Sub isitabel()
        Dim Isi As New ListViewItem
        Isi.Text = w
        Isi.SubItems.Add(NPM.Text)
        Isi.SubItems.Add(nama.Text)
        Isi.SubItems.Add(jenjang.Text)
        Isi.SubItems.Add(jurusan.Text)
        Isi.SubItems.Add(kddosen.Text)
        Isi.SubItems.Add(namadosen.Text)
        Isi.SubItems.Add(kdmakul.Text)
        Isi.SubItems.Add(namamakul.Text)
        Isi.SubItems.Add(nkehadiran.Text)
        Isi.SubItems.Add(ntugas.Text)
        Isi.SubItems.Add(nUTS.Text)
        Isi.SubItems.Add(nUAS.Text)
        Isi.SubItems.Add(nakhir.Text)
        Isi.SubItems.Add(nhuruf.Text)
        Isi.SubItems.Add(keterangan.Text)
        Lv.Items.Add(Isi)
        w = w + 1
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bsimpan.Click
        isitabel()
    End Sub
    Private Sub HapusItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bhapusitem.Click
        Lv.Items.Remove(Lv.SelectedItems(0))
    End Sub
End Class

selanjutnya tekan f5 , maka akan keluar gambar d bawah ini


Tidak ada komentar:

Posting Komentar