Kamis, 26 Januari 2012

tugas listview....




Public Class Form1

      Sub BuatTabel()

        With LV

            .Columns.Add("NPM", 80, HorizontalAlignment.Center)

            .Columns.Add("NAMA", 120, HorizontalAlignment.Left)

            .Columns.Add("JENJANG", 100, HorizontalAlignment.Left)

            .Columns.Add("JURUSAN", 100, HorizontalAlignment.Left)

            .Columns.Add("TAHUN MASUK", 100, HorizontalAlignment.Left)

            .Columns.Add("NILAI ANGKA", 80, HorizontalAlignment.Left)

            .Columns.Add("NILAI HURUF", 80, HorizontalAlignment.Left)

            .GridLines = True

            .FullRowSelect = True

            .View = View.Details

      End With

    End Sub

    Sub IsiTabel()

        Dim Lst As New ListViewItem

        With Lst

            .Text = NPM.Text(0)

            .SubItems.Add(NAMA.Text)

            .SubItems.Add(JNJNG.Text)

            .SubItems.Add(JRSN.Text)

            .SubItems.Add(THNMSK.Text)

            .SubItems.Add(ANGKA.Text)

            .SubItems.Add(HURUF.Text)

            LV.Items.Add(Lst)

        End With

    End Sub

   

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

        BuatTabel()

    End Sub

    Private Sub NPM_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NPM.TextChanged

        Dim X, Y As String

        X = Microsoft.VisualBasic.Mid(NPM.Text, 3, 1)

        Y = Microsoft.VisualBasic.Mid(NPM.Text, 4, 1)

        If X = "0" Then

            If Y = "2" Then

                JNJNG.Text = "D3"

                JRSN.Text = "Manajemen Informatika"

            End If

        ElseIf X = "1" Then

            JNJNG.Text = "S1"

            If Y = "1" Then

                JRSN.Text = "Tek.Informatika"

            ElseIf Y = "2" Then

                JRSN.Text = "Sis.Informasi"

            End If



        End If

    End Sub



    Private Sub ANGKA_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ANGKA.KeyPress

        Dim tombol As Integer = Asc(e.KeyChar)

        If tombol = 13 Then

            CariNilai()

        End If



    End Sub



    Sub CariNilai()

        If ANGKA.Text >= 85 Then

            HURUF.Text = "A"

        ElseIf ANGKA.Text >= 75 Then

            HURUF.Text = "B"

        ElseIf ANGKA.Text >= 70 Then

            HURUF.Text = "C"

        ElseIf ANGKA.Text >= 60 Then

            HURUF.Text = "D"

Tidak ada komentar:

Posting Komentar