Soucre Pgrogram:

Public Class Form1
 


    Private Sub npm_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles npm.TextChanged


        Dim x As String
        tahunmasuk.Text = "20" & Microsoft.VisualBasic.Left(npm.Text, 2)

        x = Microsoft.VisualBasic.Mid(npm.Text, 3)
        If x = "1" Then
            jenjang.Text = "diploma1"
        ElseIf x = "2" Then
            jenjang.Text = "diploma3"
        ElseIf x = "3" Then
            jenjang.Text = "stara1"
        ElseIf x = "4" Then
            jenjang.Text = "stara2"
        End If

        x = Microsoft.VisualBasic.Right(npm.Text, 2)
        If x = "01" Then
            jurusan.Text = "teknik informatika"
        ElseIf x = "02" Then
            jurusan.Text = "sistem informasi"
        ElseIf x = "03" Then
            jurusan.Text = "menajemen informatika"
        End If




    End Sub

    Private Sub nilaiangka_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nilaiangka.TextChanged
        If nilaiangka.Text >= "80" Then
            nilaihrf.Text = "A"
        ElseIf nilaiangka.Text >= "70" Then
            nilaihrf.Text = "B"
        ElseIf nilaiangka.Text >= "60" Then
            nilaihrf.Text = "C"
        ElseIf nilaiangka.Text >= "50" Then
            nilaihrf.Text = "D"

        Else
            nilaihrf.Text = "E"

        End If






    End Sub

 

    Sub baru()
        lv.Columns.Add("npm", 80, HorizontalAlignment.Center)
        lv.Columns.Add("nama", 80, HorizontalAlignment.Center)
        lv.Columns.Add("jurusan", 80, HorizontalAlignment.Center)
        lv.Columns.Add("jenjang", 80, HorizontalAlignment.Center)
        lv.Columns.Add("tahunmasuk", 80, HorizontalAlignment.Center)
        lv.Columns.Add("nilaiangka", 80, HorizontalAlignment.Center)
        lv.Columns.Add("nilaihuruf", 80, HorizontalAlignment.Center)
        lv.View = View.Details
        lv.GridLines = True
        lv.FullRowSelect = True

    End Sub


    Sub isi()
        Dim a As New ListViewItem
        a.Text = npm.Text
        a.SubItems.Add(nama.Text)
        a.SubItems.Add(jurusan.Text)
        a.SubItems.Add(jenjang.Text)
        a.SubItems.Add(tahunmasuk.Text)
        a.SubItems.Add(nilaiangka.Text)
        a.SubItems.Add(nilaihrf.Text)
        lv.Items.Add(a)



    End Sub









    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        baru()

    End Sub

    Private Sub btnlistview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlistview.Click
        isi()
        npm.Text = ""
        nama.Text = ""
        jurusan.Text = ""
        jenjang.Text = ""
        tahunmasuk.Text = ""
        nilaiangka.Text = ""
        nilaihrf.Text = ""

    End Sub

End Class

Hasil Gambar 


klik disini untuk melihat kasus dari soal ini

Leave a Reply