PublicClass Form1
Dim LST As ListViewItem
PrivateSub npm_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles npm.TextChanged
Dim x AsString
tmasuk.Text = "20"& Microsoft.VisualBasic.Left(npm.Text, 2)
x = Microsoft.VisualBasic.Mid(npm.Text, 3, 1)
If x = "1"Then
jenjang.Text = "Diploma I"
ElseIf x = "2"Then
jenjang.Text = "Diploma III"
ElseIf x = "3"Then
jenjang.Text = "Strata I"
EndIf
x = Microsoft.VisualBasic.Mid(npm.Text, 4, 2)
If x = "01"Then
jurusan.Text = "Manajemen Informatika"
ElseIf x = "02"Then
jurusan.Text = "Sistem Informasi"
ElseIf x = "03"Then
jurusan.Text = "Teknik Komputer"
ElseIf x = "04"Then
jurusan.Text = "Akuntansi"
EndIf
EndSub
PrivateSub nilaiangka_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nilaiangka.TextChanged
If nilaiangka.Text >= 90 Then
nilaihuruf.Text = "A"
ElseIf nilaiangka.Text >= 80 Then
nilaihuruf.Text = "B"
ElseIf nilaiangka.Text >= 70 Then
nilaihuruf.Text = "C"
ElseIf nilaiangka.Text = "60"Then
nilaihuruf.Text = "D"
Else
nilaihuruf.Text = "E"
EndIf
EndSub
PrivateSub btnhapuspilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapuspilih.Click
If LV.SelectedItems.Count <> 0 Then
LV.Items.Remove(LV.SelectedItems(0))
Else
MsgBox("Maaf Anda Belum"&"Memilih yang mana mau dihapus")
EndIf
EndSub
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
buat_table()
kosong()
EndSub
Sub buat_table()
With LV
.Items.Clear()
.FullRowSelect = True
.GridLines = True
.View = View.Details
.Columns.Add("npm", 100)
.Columns.Add("Nama", 100)
.Columns.Add("Jurusan", 100, HorizontalAlignment.Center)
.Columns.Add("Jenjang", 100, HorizontalAlignment.Left)
.Columns.Add(" Tahun Masuk ", 100, HorizontalAlignment.Left)
.Columns.Add("Nilai Angka", 100, HorizontalAlignment.Left)
.Columns.Add("Nilai Huruf", 100, HorizontalAlignment.Left)
EndWith
EndSub
Sub simpan()
LST = Me.LV.Items.Add(Me.npm.Text)
LST.SubItems.Add(Me.nama.Text)
LST.SubItems.Add(Me.jurusan.Text)
LST.SubItems.Add(Me.jenjang.Text)
LST.SubItems.Add(Me.tmasuk.Text)
LST.SubItems.Add(Me.nilaiangka.Text)
LST.SubItems.Add(Me.nilaihuruf.Text)
EndSub
Sub kosong()
npm.Text = ""
nama.Text = ""
jurusan.Text = ""
jenjang.Text = ""
tmasuk.Text = ""
nilaiangka.Text = ""
nilaihuruf.Text = ""
npm.Focus()
EndSub
PrivateSub btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpan.Click
Call simpan()
EndSub
PrivateSub btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
kosong()
npm.Focus()
EndSub
PrivateSub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click
Dim tanya AsString
tanya = MsgBox("Apakah Anda Yakin Ingin Keluar?"& vbCrLf &"Harus Yakin", MsgBoxStyle.Question + MsgBoxStyle.YesNo)
If tanya = vbYes Then
Me.Close()
Else
ExitSub
EndIf
EndSub
EndClass
Hasil :
Tidak ada komentar:
Posting Komentar