Sekilah kita bahas dulu apa sech itu Microsoft Visual Basic, temen2 pasti udah pada tahu apa itu Microsoft Visual Basic tinggal tanya mbah google aja dah muncul pengertiannya, Mbah google bilang sech Microsoft Visual Basic adalah merupakan sebuah bahasa pemrograman komputer yang menjadi sarana ( Tools ) untuk menghasilkan program – program aplikasi yang berbasis windows.
Nah menjelang UTS tiba, dapet tugas juga bikin rancangan perhitungan gaji memakai program microsoft visual basic, inilah rancangan awal yang dibuat cekidot --------->
LISTING KASUS I
Sub aktif()
txtnip.Enabled = True
txtnama.Enabled = True
cmbgol.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
End Sub
Sub nonaktif()
txtnip.Enabled = False
txtnama.Enabled = False
cmbgol.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
opt3.Enabled = False
txtjab.Enabled = False
txtgapok.Enabled = False
txttunjab.Enabled = False
txttrans.Enabled = False
txtstat.Enabled = False
txtgator.Enabled = False
txtpph.Enabled = False
txtgasih.Enabled = False
End Sub
Sub bersih()
txtnip.Text = ""
txtnama.Text = ""
cmbgol.Text = ""
txttgl.Text = ""
txtjab.Text = ""
txtgapok.Text = ""
txttunjab.Text = ""
txttrans.Text = ""
opt1.Value = 0
opt2.Value = 0
opt3.Value = 0
txtstat.Text = ""
txtgator.Text = ""
txtpph.Text = ""
txtgasih.Text = ""
End Sub
Private Sub cmbgol_Click()
If cmbgol.Text = "I" Then
txtjab.Text = "Paintry"
txtgapok.Text = 1000000
txttunjab.Text = 200000
txttrans.Text = 0
ElseIf cmbgol.Text = "II" Then
txtjab.Text = "Staff"
txtgapok.Text = 1750000
txttunjab.Text = 300000
txttrans.Text = 200000
ElseIf cmbgol.Text = "III" Then
txtjab.Text = "Supervisor"
txtgapok.Text = 2250000
txttunjab.Text = 500000
txttrans.Text = 300000
ElseIf cmbgol.Text = "IV" Then
txtjab.Text = "Manager"
txtgapok.Text = 5000000
txttunjab.Text = 700000
txttrans.Text = 500000
Else
txtjab.Text = "Direktur"
txtgapok.Text = 10000000
txttunjab.Text = 1000000
txttrans.Text = 1000000
End If
End Sub
Private Sub cmdhitung_Click()
bersih
aktif
txttgl.Text = Date
txtnip.SetFocus
cmbgol.Text = "-Pilih-"
End Sub
Private Sub cmdkeluar_Click()
X = MsgBox("Yakin Keluar", vbYesNo + vbQuestion, "Konfirmasi")
If X = vbYes Then
Unload Me
End If
End Sub
Private Sub Form_Activate()
bersih
nonaktif
txttgl.Text = Date
cmbgol.AddItem "I"
cmbgol.AddItem "II"
cmbgol.AddItem "III"
cmbgol.AddItem "IV"
cmbgol.AddItem "V"
cmdhitung.Enabled = True
cmdkeluar.Enabled = True
End Sub
Private Sub opt1_Click()
If opt1.Value = True Then
txtstat.Text = 300000
txtgator.Text = Val(txtgapok.Text) + Val(txttunjab.Text) + Val(txttrans.Text) + Val(txtstat.Text)
txtpph.Text = 0.1 * Val(txtgator.Text)
txtgasih.Text = Val(txtgator.Text) - Val(txtpph.Text)
End If
End Sub
Private Sub opt2_Click()
If opt2.Value = True Then
txtstat.Text = 0
txtgator.Text = Val(txtgapok.Text) + Val(txttunjab.Text) + Val(txttrans.Text) + Val(txtstat.Text)
txtpph.Text = 0.1 * Val(txtgator.Text)
txtgasih.Text = Val(txtgator.Text) - Val(txtpph.Text)
End If
End Sub
Private Sub opt3_Click()
If opt3.Value = True Then
txtstat.Text = 100000
txtgator.Text = Val(txtgapok.Text) + Val(txttunjab.Text) + Val(txttrans.Text) + Val(txtstat.Text)
txtpph.Text = 0.1 * Val(txtgator.Text)
txtgasih.Text = Val(txtgator.Text) - Val(txtpph.Text)
End If
End Sub
Tidak ada komentar:
Posting Komentar