Latihan_UTS VB
Ditulis oleh desitie di/pada 17 April 2007
Buat tampilan sebagai berikut :
Private Sub ch1_Click()
If ch1 = 1 And ch2 = 0 Then
txttunj.Text = 10 / 100 * Val(txtgapok.Text)
Else
If ch1 = 0 And ch2 = 1 Then
txttunj.Text = 5 / 100 * Val(txtgapok.Text)
Else
If ch1 = 1 And ch2 = 1 Then
txttunj.Text = 15 / 100 * Val(txtgapok.Text)
Else
txttunj.Text = 0
End If
End If
End If
End Sub
Private Sub ch2_Click()
If ch1 = 1 And ch2 = 0 Then
txttunj.Text = 10 / 100 * Val(txtgapok.Text)
Else
If ch1 = 0 And ch2 = 1 Then
txttunj.Text = 5 / 100 * Val(txtgapok.Text)
Else
If ch1 = 1 And ch2 = 1 Then
txttunj.Text = 15 / 100 * Val(txtgapok.Text)
Else
txttunj.Text = 0
End If
End If
End If
End Sub
Private Sub cmdhitung_Click()
txttotal.Text = Val(txtgapok.Text) + Val(txttunj.Text)
End Sub
Private Sub bersih()
Dim x As Control
For Each x In Me
If TypeName(x) = “TextBox” Then
x.Text = “”
End If
Next
ch1 = o
ch2 = 0
End Sub
Private Sub cmdinput_Click()
bersih
tampil
txtnip.SetFocus
End Sub
Private Sub Form_Load()
sembunyi
End Sub
Private Sub txtnip_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Left(txtnip, 4) = “2005″ Then
txtthn.Text = “2005″
Else
If Left(txtnip, 4) = “2006″ Then
txtthn.Text = “2006″
Else
If Left(txtnip, 4) = “2007″ Then
txtthn.Text = “2007″
Else
MsgBox “Tahun Masuk Tidak Ada”, vbOKOnly, “Info”
bersih
sembunyi
End If
End If
End If
If Mid(txtnip, 5, 2) = “01″ Then
txtjbtn.Text = “Direktur”
txtgapok.Text = 1500000
Else
If Mid(txtnip, 5, 2) = “02″ Then
txtjbtn.Text = “Staff”
txtgapok.Text = 1000000
Else
If Mid(txtnip, 5, 2) = “03″ Then
txtjbtn.Text = “umum”
txtgapok.Text = 850000
Else
bersih
sembunyi
End If
End If
End If
End If
End Sub
Private Sub sembunyi()
txtnip.Visible = False
Label2.Visible = False
End Sub
Private Sub tampil()
txtnip.Visible = True
Label2.Visible = True
End Sub
Silakan Anda Modifikasi lagi untuk belajar …..
orido berkata
mangap…
binun…
melirik planetsourcecode.com deh..
desitie berkata
terima kasih atas infonya
arliyana STMIK Palangka Raya berkata
kirimin listing VB yang lain dunk!!!!!