Senin, 23 Januari 2012

Halaman 32



Public Class Form1

   
    Sub buattabel()
        LV.Columns.Add("NPM", 80, HorizontalAlignment.Center)
        LV.Columns.Add("NAMA", 100, HorizontalAlignment.Center)
        LV.Columns.Add("JURUSAN", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Jenjang", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Tahun Masuk", 120, HorizontalAlignment.Center)
        LV.Columns.Add("Nilai Angka", 120, HorizontalAlignment.Center)
        LV.Columns.Add("Nilai Huruf", 100, HorizontalAlignment.Center)
        LV.View = View.Details
        LV.GridLines = True
        LV.FullRowSelect = True

    End Sub
    Sub isitabel()
        Dim lst As New ListViewItem
        lst.Text = npm.Text
        lst.SubItems.Add(nama.Text)
        lst.SubItems.Add(jurusan1.Text)
        lst.SubItems.Add(jenjang1.Text)
        lst.SubItems.Add(tahun_masuk.Text)
        lst.SubItems.Add(n_angka.Text)
        lst.SubItems.Add(n_huruf.Text)
        LV.Items.Add(lst)
    End Sub

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

    End Sub

    Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
        Call isitabel()
        npm.Text = ""
        nama.Text = ""
        jurusan1.Text = ""
        jenjang1.Text = ""
        tahun_masuk.Text = ""
        n_angka.Text = ""
        n_huruf.Text = ""

        npm.Focus()

    End Sub

    Private Sub npm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles npm.KeyPress
        If e.KeyChar = Chr(13) Then

        End If
        Dim x As String
        tahun_masuk.Text = "20" & "10"
        Microsoft.VisualBasic.Left(npm.Text, 2)
        x = Microsoft.VisualBasic.Mid(npm.Text, 3, 1)
        If x = "1" Then
            jenjang1.Text = "Diploma I"
            nama.Text = "Feriyansyah"
        ElseIf x = "2" Then
            jenjang1.Text = "Diploma III"
            nama.Text = "Dewi Yulianti"
        ElseIf x = "3" Then
            jenjang1.Text = "Sastra I"
            nama.Text = "Rudihatno"


        End If
        x = Microsoft.VisualBasic.Mid(npm.Text, 4, 2)
        If x = "14" Then
            jurusan1.Text = "Manajemen Informatika"
        ElseIf x = "11" Then
            jurusan1.Text = "Akuntansi"
        ElseIf x = "12" Then
            jurusan1.Text = "Teknik Informasi"
        ElseIf x = "13" Then
            jurusan1.Text = "Sistem Informasi"

        End If

    End Sub

    Private Sub n_angka_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles n_angka.KeyPress
        If e.KeyChar = Chr(13) Then
            If n_angka.Text <= 50 Then
                n_huruf.Text = "E"
            ElseIf n_angka.Text <= 60 Then
                n_huruf.Text = "D"
            ElseIf n_angka.Text <= 70 Then
                n_huruf.Text = "C"
            ElseIf n_angka.Text <= 80 Then
                n_huruf.Text = "B"
            ElseIf n_angka.Text <= 100 Then
                n_huruf.Text = "A"

            End If
        End If

    End Sub
    Private Sub bersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bersih.Click
        npm.Text = ""
        nama.Text = ""
        jenjang1.Text = ""
        jurusan1.Text = ""
        tahun_masuk.Text = ""
        n_angka.Text = ""
        n_huruf.Text = ""

    End Sub

    Private Sub hapus_semua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus_semua.Click
        LV.Items.Clear()

    End Sub

    Private Sub hapus_pilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus_pilih.Click
        LV.Items.Remove(LV.SelectedItems(0))

    End Sub

    Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
        Dim a As String
        a = MsgBox("Anda Yakin ..??????", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Keluar")
        If a = vbYes Then
            Close()

        End If
    End Sub

    Private Sub jurusan1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jurusan1.TextChanged
        n_angka.Focus()

    End Sub
End Class

Bentuk form:


Tidak ada komentar:

Posting Komentar