Tugas 4

Image

Private Sub Cmdbaru_Click()
Data1.Recordset.AddNew
Textnama.SetFocus
End Sub

Private Sub Cmddelete_Click()
Data1.Recordset.Delete
End Sub

Private Sub Cmdkeluar_Click()
Unload Me
End Sub

Private Sub Cmdproses_Click()
Dim s, ps, jr As String
Texttahun.Text = “20” & Left(Textnpm.Text, 2)
s = Mid(Textnpm.Text, 3, 1)
If s = “1” Then
jr = “sistem informasi”
ElseIf s = “2” Then
jr = “manajemen informatika”
ElseIf s = “3” Then
jr = “teknik informatika”
ElseIf s = “4” Then
jr = “Master komputer”
End If
s = Mid(Textnpm.Text, 4, 2)
If s = “01” Then
ps = “strata satu”
ElseIf s = “02” Then
ps = “Diploma empat”
ElseIf s = “03” Then
ps = “Diploma tiga”
ElseIf s = “04” Then
ps = “Diploma satu”
End If
Textjurusan.Text = jr
Textprody.Text = ps
Texturut.Text = Right(Textnpm.Text, 3)
End Sub

Private Sub Cmdsimpan_Click()
Data1.Recordset.Update
Textnama.SetFocus
End Sub

Private Sub Textnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Textnpm.SetFocus
End If
End Sub

Advertisements

tugas

ImagePrivate Sub Cbogolongan_Click()
Dim gapok, pajak, tunjangan, total As Variant
Select Case Cbogolongan.Text
Case “I”
gapok = 1500000
tunjangan = 150000
Case “II”
gapok = 2000000
tunjangan = 200000
Case “III”
gapok = 2500000
tunjangan = 250000
Case “IV”
gapok = 3000000
tunjangan = 300000
Case Else
gapok = 0
tunjangan = 0
End Select
total = gapok + tunjangan
pajak = total * 0.1
Txtgapok.Text = gapok
txttunjangan.Text = tunjangan
txtpajak.Text = pajak
txttotal.Text = total – pajak
End Sub

Private Sub Cmdbatal_Click()
Txtnidn.SetFocus
Txtnidn.Text = “”
txtnama.Text = “”
txtgolongan.Text = “”
Txtgapok.Text = “”
txttunjangan.Text = “”
txtpajak.Text = “”
txttotal.Text = “”

End Sub

Private Sub Cmdkeluar_Click()
Unload Me
End Sub

Private Sub Cmdlagi_Click()
Txtnidn.SetFocus
Txtnidn.Text = “”
txtnama.Text = “”
txtgolongan.Text = “”
Txtgapok.Text = “”
txttunjangan.Text = “”
txtpajak.Text = “”
txttotal.Text = “”

End Sub

Private Sub Form_Load()
Cbogolongan.AddItem “I”
Cbogolongan.AddItem “II”
Cbogolongan.AddItem “III”
Cbogolongan.AddItem “IV”

End Sub

Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Cbogolongan.SetFocus
End If
End Sub

Private Sub Txtnidn_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnama.SetFocus
End If
End Sub

tugas vb

ImagePrivate Sub Command1_Click()
Dim s, jb, peng, penr, hrg As String
Text4.Text = “20” & Left(Text1.Text, 2)
s = Mid(Text1.Text, 3, 1)
If s = “1” Then
jb = “indahnya dunia”
ElseIf s = “2” Then
jb = “cahaya ilahi”
ElseIf s = “3” Then
jb = “sistem pengantar komputer”
End If
Text2.Text = jb
s = Mid(Text1.Text, 4, 2)
If s = “01” Then
peng = “miftahudin stmik”
ElseIf s = “02” Then
peng = “samsul hadi”
ElseIf s = “03” Then
peng = “faizal imron”
End If
s = Mid(Text1.Text, 5, 2)
If s = “11” Then
pnrbt = “kompas candika”
ElseIf s = “12” Then
pnrbt = “raharja com”
ElseIf s = “13” Then
pnrbt = “maya colekword”
End If
s = Right(Text1.Text, 2)
If s = “45” Then
hrg = 25000
ElseIf s = “46” Then
hrg = 30000
ElseIf s = “47” Then
hrg = 35000
End If
Text3.Text = peng
Text5.Text = pnrbt
Text6.Text = hrg
End Sub

Private Sub Command2_Click()
Text1.SetFocus
Text1 = “”
Text2 = “”
Text3 = “”
Text4 = “”
Text5 = “”
Text6 = “”
End Sub

Private Sub Command3_Click()
Text1.SetFocus
Text1 = “”
Text2 = “”
Text3 = “”
Text4 = “”
Text5 = “”
Text6 = “”
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

PULANG PETANG

 


Private Sub CmdBatal_Click()
TxtNama.SetFocus
TxtGolongan = “”
TxtKode = “”
TxtStatus = “”
TxtTahun = “”
TxtJabatan = “”
TxtBagian = “”
TxtGaji = “”
TxtTunjangan = “”
TxtGajitotal = “”
TxtNama = “”
TxtNIK = “”
End Sub

Private Sub CmdKeluar_Click()
Unload Me
End Sub

Private Sub CmdLagi_Click()
TxtNama.SetFocus
TxtGolongan = “”
TxtKode = “”
TxtStatus = “”
TxtTahun = “”
TxtJabatan = “”
TxtBagian = “”
TxtGaji = “”
TxtTunjangan = “”
TxtGajitotal = “”
TxtNama = “”
TxtNIK = “”
End Sub

Private Sub CmdPROSES_Click()
Dim H, GOLONGAN, KODESTATUS, STATUS, JABATAN, BAGIAN, GAJIPOKOK, TUNJANGAN, TOTALGAJI, asstring
TxtTahun.Text = “” & Left(TxtNIK.Text, 4)
H = Mid(TxtNIK.Text, 5, 1)
If H = “A” Then
GOLONGAN = “A”
ElseIf H = “B” Then
GOLONGAN = “B”
ElseIf H = “C” Then
GOLONGAN = “C”
End If
TxtGolongan.Text = GOLONGAN
H = Mid(TxtNIK.Text, 5, 1)
If H = “A” Then
JABATAN = “Manajer”
ElseIf H = “B” Then
JABATAN = “Ka. Seksi”
ElseIf H = “C” Then
JABATAN = “Staff”
End If
TxtJabatan.Text = JABATAN
H = Mid(TxtNIK.Text, 5, 1)
If H = “A” Then
GAJIPOKOK = “4000000”
ElseIf H = “B” Then
GAJIPOKOK = “3500000”
ElseIf H = “C” Then
GAJIPOKOK = “3000000”
End If
TxtGaji.Text = GAJIPOKOK
H = Mid(TxtNIK.Text, 5, 1)
If H = “A” Then
TUNJANGAN = “1025000”
ElseIf H = “B” Then
TUNJANGAN = “975000”
ElseIf H = “C” Then
TUNJANGAN = “925000”
End If
TxtTunjangan.Text = TUNJANGAN
H = Mid(TxtNIK.Text, 7, 1)
If H = “S” Then
KODESTATUS = “S”
ElseIf H = “M” Then
KODESTATUS = “M”
ElseIf H = “J” Then
KODESTATUS = “J”
ElseIf H = “D” Then
KODESTATUS = “D”
End If
TxtKode.Text = KODESTATUS
H = Mid(TxtNIK.Text, 7, 1)
If H = “S” Then
STATUS = “Single”
ElseIf H = “M” Then
STATUS = “Menikah”
ElseIf H = “J” Then
STATUS = “Janda”
ElseIf H = “D” Then
STATUS = “Duda”
End If
TxtStatus.Text = STATUS
H = Right(TxtNIK.Text, 3)
If H = “KEU” Then
BAGIAN = “Accounting”
ElseIf H = “ADM” Then
BAGIAN = “Administrasi”
ElseIf H = “SDM” Then
BAGIAN = “General Affair”
ElseIf H = “EDP” Then
BAGIAN = “IP Unit”
ElseIf H = “SPM” Then
BAGIAN = “Security”
End If
TxtBagian.Text = BAGIAN
TxtGajitotal.Text = Val(TXTGAJIText) + Val(TxtTunjangan.Text)

End Sub

Private Sub TxtNama_KEYPRESS(KEYASCII As Integer)
If KEYASCII = 13 Then
TxtNIK.SetFocus
End If

End SubImage

tugas 2.4

Image
Private Sub Command1_Click()
Dim s, ps, jr As String
Text5.Text = “20” & Left(Text2.Text, 2)
s = Mid(Text2.Text, 3, 1)
If s = “1” Then
jr = “sistem informasi”
ElseIf s = “2” Then
jr = “manajemen informatika”
ElseIf s = “3” Then
jr = “teknik informatika”
ElseIf s = “4” Then
jr = “Master komputer”
End If
s = Mid(Text2.Text, 4, 2)
If s = “01” Then
ps = “strata satu”
ElseIf s = “02” Then
ps = “Diploma empat”
ElseIf s = “03” Then
ps = “Diploma tiga”
ElseIf s = “04” Then
ps = “Diploma satu”
End If
Text3.Text = jr
Text4.Text = ps
Text6.Text = Right(Text2.Text, 3)
End Sub

Private Sub Command2_Click()
Text1.SetFocus
Text1 = “”
Text2 = “”
Text3 = “”
Text4 = “”
Text5 = “”
Text6 = “”
End Sub

Private Sub Command3_Click()
Text1.SetFocus
Text1 = “”
Text2 = “”
Text3 = “”
Text4 = “”
Text5 = “”
Text6 = “”
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub

tugas 2-3

Image

Private Sub Combo1_Click()
Dim nama, jurusan, HM As String
Select Case Combo1.Text
Case “12100177”
nama = “marhatun”
jurusan = “Sistem Informasi”
Case “12100146”
nama = “M FUAIDI ABDILAH”
jurusan = “Diploma Empat”
Case “12100322”
nama = “weni refikasari”
jurusan = “Diploma Tiga”
Case “12100148”
nama = “M FUAD HASYIM”
jurusan = “Diploma Dua”
Case “12100179”
nama = “ani fitriyani”
jurusan = “Diploma Satu”
End Select
Text1.Text = nama
Text2.Text = jurusan
Text3.SetFocus
End Sub

Private Sub command1_Click()
Dim NA As Integer
Dim HM As String
QUIS = Val(Text3.Text)
TUGAS = Val(Text4.Text)
UTS = Val(Text5.Text)
UAS = Val(Text6.Text)
NA = (QUIS + TUGAS + UTS + UAS) / 4
Text7.Text = NA

Select Case Text7.Text
Case Is > 80
HM = “A”
Case Is > 70
HM = “B”
Case Is > 60
HM = “C”
Case Is > 50
HM = “D”
Case Is < 50
HM = “E”
End Select
Text8.Text = HM
End Sub

Private Sub Command2_Click()
Combo1.SetFocus
Combo1.Text = “”
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
Text7.Text = “”
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Form_Load()
Combo1.AddItem “12100177”
Combo1.AddItem “12100146”
Combo1.AddItem “12100322”
Combo1.AddItem “12100148”
Combo1.AddItem “12100179”
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text5.SetFocus
End If
End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text6.SetFocus
End If
End Sub

Image

Private Sub Check1_Click()
Label2.FontBold = Check1.Value
End Sub

Private Sub Check2_Click()
Label2.FontItalic = Check2.Value
End Sub

Private Sub Command1_Click()
Label2.Caption = Text1.Text
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()

End Sub

Private Sub Option1_Click()
Label2.ForeColor = vbBlue
End Sub

Private Sub Option2_Click()
Label2.ForeColor = vbRed
End Sub