Ketikan sintax ini pada VB.Net 2008
Public Class Form1
Private Sub Jabatan_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Jabatan.SelectedIndexChanged
Select Case Jabatan.Text
Case
"Mandor" : Gaji.Text = 1750000
Case
"Kepala Bagian" : Gaji.Text =
2500000
Case
"staff" : Gaji.Text = 1250000
End Select
Pajak.Text = 0.015 * Gaji.Text
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Nik.Items.Add("001")
Nik.Items.Add("002")
Nik.Items.Add("003")
Jabatan.Items.Add("Mandor")
Jabatan.Items.Add("Kepala Bagian")
Jabatan.Items.Add("Staff")
Status.Items.Add("Menikah")
Status.Items.Add("Tidak Menikah")
BuatTabel()
For i =
1 To 4
JA.Items.Add(i)
Next i
For i =
1 To 10
JL.Items.Add(i)
Next i
End Sub
Private Sub Status_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Status.SelectedIndexChanged
Select Case Status.Text
Case
"Menikah" : TI.Text = 0.09 *
Gaji.Text
Case
"Tidak Menikah" : TI.Text = 0.09 *
Gaji.Text
End Select
End Sub
Private Sub JA_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
JA.SelectedIndexChanged
If
JA.Text >= 2 And Status.Text = "Menikah" Then
TA.Text = 0.07 * Gaji.Text
ElseIf
JA.Text = 1 And Status.Text = "Menikah" Then
TA.Text = 0.03 * Gaji.Text
Else
TA.Text = 0
End If
End Sub
Private Sub BtnProses_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BtnProses.Click
IsiTabel()
If
Jabatan.Text = "Mandor" Then
HL.Text = 7500
ElseIf
Jabatan.Text = "Kepala Bagian" Then
HL.Text = 10000
ElseIf
Jabatan.Text = "Staff" Then
HL.Text = 5000
Else
HL.Text = 0
End If
Total.Text = Val(HL.Text * JL.Text) +
Val(Gaji.Text) + Val(TI.Text) + Val(TA.Text) - Val(Pajak.Text)
End Sub
Private Sub Btnbaru_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnbaru.Click
Nik.Text = ""
Nama.Text = ""
Jabatan.Text = ""
Gaji.Text = ""
Status.Text = ""
TI.Text = ""
JA.Text = ""
TA.Text = ""
JL.Text = ""
HL.Text = ""
Pajak.Text = ""
End Sub
Private Sub BtnKeluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BtnKeluar.Click
End
End Sub
Private Sub Nik_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Nik.SelectedIndexChanged
Select Case Nik.Text
Case
"001" : Nama.Text = "Maya"
Case
"002" : Nama.Text = "Tumpal"
Case
"003" : Nama.Text = "Ronald"
End Select
End Sub
Private Sub LV_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
LV.SelectedIndexChanged
End Sub
Sub
BuatTabel()
LV.Columns.Add("Nik",
50, HorizontalAlignment.Center)
LV.Columns.Add("Nama",
50, HorizontalAlignment.Center)
LV.Columns.Add("Jabatan",
50, HorizontalAlignment.Center)
LV.Columns.Add("gaji",
50, HorizontalAlignment.Center)
LV.Columns.Add("Status",
50, HorizontalAlignment.Center)
LV.Columns.Add("Tunj.Istri",
50, HorizontalAlignment.Center)
LV.Columns.Add("Jumlah
Anak", 50, HorizontalAlignment.Center)
LV.Columns.Add("Tunj.Anak",
50, HorizontalAlignment.Center)
LV.Columns.Add("Jam
Lembur", 50, HorizontalAlignment.Center)
LV.Columns.Add("Honor
Lembur", 50, HorizontalAlignment.Center)
LV.Columns.Add("Pajak",
50, HorizontalAlignment.Center)
LV.Columns.Add("Total",
50, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub
IsiTabel()
Dim Lst
As New
ListViewItem
Lst.Text = Nik.Text
Lst.SubItems.Add(Nama.Text)
Lst.SubItems.Add(Jabatan.Text)
Lst.SubItems.Add(Gaji.Text)
Lst.SubItems.Add(Status.Text)
Lst.SubItems.Add(TI.Text)
Lst.SubItems.Add(JA.Text)
Lst.SubItems.Add(TA.Text)
Lst.SubItems.Add(JL.Text)
Lst.SubItems.Add(HL.Text)
Lst.SubItems.Add(Pajak.Text)
Lst.SubItems.Add(Total.Text)
LV.Items.Add(Lst)
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnsimpan.Click
IsiTabel()
Nik.Text = ""
Nama.Text = ""
Jabatan.Text = ""
Gaji.Text = ""
Status.Text = ""
TI.Text = ""
JA.Text = ""
JL.Text = ""
HL.Text = ""
Pajak.Text = ""
Total.Text = ""
End Sub
End Class
Maka akan tampaklah hasil seperti berikut ini :
0 komentar:
Posting Komentar