Public Class Form1
Dim LST As ListViewItem
Private Sub npm_TextChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles npm.TextChanged
Dim x As String
tahun.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"
End If
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"
End If
End Sub
Private Sub nangka_TextChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles nangka.TextChanged
If
nangka.Text >= 90 Then
nhuruf.Text = "A"
ElseIf
nangka.Text >= 80 Then
nhuruf.Text = "B"
ElseIf
nangka.Text >= 70 Then
nhuruf.Text = "C"
ElseIf
nangka.Text = "60" Then
nhuruf.Text = "D"
Else
nhuruf.Text = "E"
End If
End Sub
Private Sub btnhapusdata_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnhapusdata.Click
If
LV.SelectedItems.Count <> 0 Then
LV.Items.Remove(LV.SelectedItems(0))
Else
MsgBox("maaf
anda belum" & "memilih yang
mana mau dihapus")
End If
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
buat_table()
kosong()
End Sub
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)
End With
End Sub
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.tahun.Text)
LST.SubItems.Add(Me.nangka.Text)
LST.SubItems.Add(Me.nhuruf.Text)
End Sub
Sub
kosong()
NPM.Text = ""
NAMA.Text = ""
JURUSAN.Text = ""
jenjang.Text = ""
tahun.Text = ""
nangka.Text = ""
nhuruf.Text = ""
NPM.Focus()
End Sub
Private Sub btnsimpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnsimpan.Click
Call
simpan()
End Sub
Private Sub btnbersih_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnbersih.Click
kosong()
npm.Focus()
End Sub
Private Sub btnkeluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnkeluar.Click
Dim
tanya As String
tanya = MsgBox("Apakah
Anda Yakin Ingin Keluar?" & vbCrLf & "Harus Yakin", MsgBoxStyle.Question +
MsgBoxStyle.YesNo)
If
tanya = vbYes Then
Me.Close()
Else
Exit
Sub
End If
End Sub
End Class
Tidak ada komentar:
Posting Komentar