Tugas VB smester 2

TUGAS SMESTER 2

 

 

Private Sub Command1_Click()
Dim snpm As String
snpm = InputBox(“npm:”)
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find “npm =” & snpm & “”
End Sub

Private Sub Command2_Click()
Text1.SetFocus
Adodc1.Recordset.AddNew
End Sub

Private Sub Command3_Click()
Adodc1.Recordset.Update
MsgBox “data berhasl disimpan…!!!”, vbOKOnly + vbInformation, “konfirmasi”
End Sub

Private Sub Command4_Click()
If MsgBox(“apakah anda yakin akan menghpusnya…???”, vbOKcancle + vbCritical, “konfirmasi”) = vbOK Then
Adodc1.Recordset.Delete
End Sub

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

 

tugas vb:9

9

Private Sub cmdBTL_Click()
txtNK.SetFocus
txtGOL.Text = “”
txtKS.Text = “”
txtS.Text = “”
txtTH.Text = “”
txtJB.Text = “”
txtBG.Text = “”
txtGPOK.Text = “”
txtTNJ.Text = “”
txtTTAL.Text = “”
txtNK.Text = “”
txtNIK.Text = “”
End Sub

Private Sub cmdKL_Click()
End
End Sub

Private Sub cmdLG_Click()
txtNK.SetFocus
txtGOL.Text = “”
txtKS.Text = “”
txtS.Text = “”
txtTH.Text = “”
txtJB.Text = “”
txtBG.Text = “”
txtGPOK.Text = “”
txtTNJ.Text = “”
txtTTAL.Text = “”
txtNK.Text = “”
txtNIK.Text = “”
End Sub

Private Sub cmdPRS_Click()
Dim gl, ks, s As String
Dim th, jb, bg As Variant
Dim gp, tnj, ttal As Long
txtTH.Text = Left(txtNIK.Text, 4)
a = Mid(txtNIK.Text, 5, 1)
If a = “A” Then
gl = “A”
jb = “Manager”
gp = “4000000″
tnj = “1025000″
ElseIf a = “B” Then
gl = “B”
jb = “Ka. Seksi”
gp = “3500000″
tnj = “975000″
ElseIf a = “C” Then
gl = “C”
jb = “Staff”
gp = “3000000″
tnj = “950000″
End If
txtGOL.Text = gl
txtJB.Text = jb
txtGPOK.Text = gp
txtTNJ.Text = tnj
a = Right(txtNIK.Text, 3)
If a = “KEU” Then
bg = “Accounting”
ElseIf a = “ADM” Then
bg = “Administrasi”
ElseIf a = “SDM” Then
bg = “General Affair”
ElseIf a = “EDP” Then
bg = “IT Unit”
ElseIf a = “SDP” Then
bg = “Security”
End If
txtBG.Text = bg
a = Mid(txtNIK.Text, 7, 1)
If a = “S” Then
ks = “S”
s = “Single”
ElseIf a = “M” Then
ks = “M”
s = “Menikah”
ElseIf a = “J” Then
ks = “J”
s = “Janda”
ElseIf a = “D” Then
ks = “D”
s = “Duda”
End If
txtKS.Text = ks
txtS.Text = s
txtTTAL.Text = Val(txtGPOK.Text) + Val(txtTNJ.Text)
End Sub

Private Sub txtNK_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtNIK.SetFocus
End If
End Sub

tugas vb:8

8

Private Sub cmdbatal_Click()
cbo.SetFocus
cbo.Text = “”
txta.Text = “”
txtb.Text = “”
txtc.Text = “”
txtd.Text = “”
txte.Text = “”
End Sub

Private Sub cmdkeluar_Click()
End
End Sub

Private Sub cmdlagi_Click()
cbo.SetFocus
cbo.Text = “”
txta.Text = “”
txtb.Text = “”
txtc.Text = “”
txtd.Text = “”
txte.Text = “”
End Sub

Private Sub cmdproses_Click()
Dim jb, pg, tt As String
Dim pt, hg As Variant
txtc.Text = “20″ & Mid(cbo.Text, 5, 2)
a = Left(cbo.Text, 3)
If a = “sim” Then
jb = “sistem informasi management”
pg = “fadiya ulfa”
hg = “75900″
ElseIf a = “edp” Then
jb = “elektronic data processing”
pg = “nurul agustina”
hg = “62000″
ElseIf a = “mnj” Then
jb = “manajemen”
pg = “rian hidayat”
hg = “42000″
ElseIf a = “cdr” Then
jb = “coreldraw”
pg = “siti nur khotimah”
hg = “53000″
ElseIf a = “rpl” Then
jb = “rekayasa perangkat lunak”
pg = “winda erlianti”
hg = “83000″
End If
txta.Text = jb
txtb.Text = pg
txte.Text = hg
a = Right(cbo.Text, 1)
If a = “a” Then
pt = “andi offset yogyakarta”
ElseIf a = “i” Then
pt = “indah surabaya”
ElseIf a = “s” Then
pt = “selemba empat”
ElseIf a = “e” Then
pt = “elek media komputindo”
ElseIf a = “m” Then
pt = “maxicom”
End If
txtd.Text = pt
End Sub

Private Sub Form_Load()
cbo.AddItem “sim-09-a”
cbo.AddItem “edp-10-i”
cbo.AddItem “mnj-11-s”
cbo.AddItem “cdr-12-e”
cbo.AddItem “rpl-13-m”
End Sub

tugas vb:7

7

Private Sub cmdbatal_Click()
cbo.SetFocus
cbo.Text = “”
txta.Text = “”
txtb.Text = “”
txtc.Text = “”
txtd.Text = “”
txte.Text = “”
End Sub

Private Sub cmdkeluar_Click()
End
End Sub

Private Sub cmdlagi_Click()
cbo.SetFocus
cbo.Text = “”
txta.Text = “”
txtb.Text = “”
txtc.Text = “”
txtd.Text = “”
txte.Text = “”
End Sub

Private Sub cmdproses_Click()
Dim jb, pg, tt As String
Dim pt, hg As Variant
txtc.Text = “20″ & Right(cbo.Text, 2)
a = Mid(cbo.Text, 3, 3)
If a = “sim” Then
jb = “sistem informasi management”
pg = “yati nur oktavia”
hg = “75900″
ElseIf a = “edp” Then
jb = “elektronic data processing”
pg = “imam tarmizi”
hg = “62000″
ElseIf a = “mnj” Then
jb = “manajemen”
pg = “valentina mariana adiwianti”
hg = “42000″
ElseIf a = “cdr” Then
jb = “coreldraw”
pg = “riyan suhandi”
hg = “53000″
ElseIf a = “rpl” Then
jb = “rekayasa perangkat lunak”
pg = “sinta umpu singa”
hg = “83000″
End If
txta.Text = jb
txtb.Text = pg
txte.Text = hg
a = Left(cbo.Text, 1)
If a = “a” Then
pt = “andi offset yogyakarta”
ElseIf a = “i” Then
pt = “indah surabaya”
ElseIf a = “s” Then
pt = “selemba empat”
ElseIf a = “e” Then
pt = “elek media komputindo”
ElseIf a = “m” Then
pt = “maxicom”
End If
txtd.Text = pt
End Sub

Private Sub Form_Load()
cbo.AddItem “a-sim-01″
cbo.AddItem “i-edp-02″
cbo.AddItem “s-mnj-03″
cbo.AddItem “e-cdr-04″
cbo.AddItem “m-rpl-05″
End Sub

tugas vb:6

6

Private Sub Cbo_Click()

Dim nama, jurusan, HM As String

 

Select Case cbo.Text

Case “12100410”

nama = “DWI INDAH YANTI”

jurusan = “Sistem Informasi”

Case “12201111”

nama = “FAJAR DESWANTORO”

jurusan = “Manajemen Informatika”

Case “12201109”

nama = “AYU OKTAVIANI”

jurusan = “Manajemen Informatika”

End Select

txtnama.Text = nama

txtjr.Text = jurusan

txtquis.SetFocus

End Sub

 

Private Sub Cmdbatal_Click()

cbo.SetFocus

cbo.Text = “”

txtnama.Text = “”

txtjr.Text = “”

txtquis.Text = “”

txttugas.Text = “”

txtuts.Text = “”

txtuas.Text = “”

txtna.Text = “”

txtm.Text = “”

End Sub

 

Private Sub cmdk_Click()

End

End Sub

 

Private Sub cmdprs_Click()

Dim na As Integer

Dim HM As Variant

quis = Val(txtquis.Text)

tugas = Val(txttugas.Text)

uts = Val(txtuts.Text)

uas = Val(txtuas.Text)

na = (quis + tugas + uts + uas) / 4

txtna.Text = na

 

Select Case txtna.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

txtm.Text = HM

End Sub

 

Private Sub Form_Load()

cbo.AddItem “12100410”

cbo.AddItem “12201111”

cbo.AddItem “12201109”

End Sub

 

Private Sub txtnama_Change()

 

End Sub

 

Private Sub txtquis_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txttugas.SetFocus

End If

End Sub

 

Private Sub txttugas_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtuts.SetFocus

End If

End Sub

 

Private Sub txtuts_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtuas.SetFocus

End If

End Sub

tugas vb:5

5

Private Sub cmdkeluar_Click()
Unload Me
End Sub

Private Sub Cmdlagi_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
txtjur.Text = “”
txtps.Text = “”
txttm.Text = “”
txturut.Text = “”
End Sub

Private Sub Cmdbatal_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
txtjur.Text = “”
txtps.Text = “”
txttm.Text = “”
txturut.Text = “”
End Sub

Private Sub Cmdproses_Click()
Dim S As String
txttm.Text = “20″ & Left(txtnpm.Text, 2)
S = Mid(txtnpm.Text, 3, 1)
If S = “1″ Then
txtjur.Text = “Sistem Informasi”
ElseIf S = “2″ Then
txtjur.Text = “Manajemen Informatika”
ElseIf S = “3″ Then
txtjur.Text = “Tehnik Informatika”
ElseIf S = “4″ Then
txtjur.Text = “Manajemen & Komp. Akuntansi”
End If
S = Mid(txtnpm.Text, 4, 2)
If S = “01″ Then
txtps.Text = “Strata Satu”
ElseIf S = “02″ Then
txtps.Text = “Diploma Tiga”
ElseIf S = “03″ Then
txtps.Text = “Diploma Empat”
ElseIf S = “04″ Then
txtps.Text = “Diploma Dua”
End If
txturut.Text = Right(txtnpm.Text, 4)
End Sub

Private Sub Form_activate()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
txtjur.Text = “”
txtps.Text = “”
txttm.Text = “”
txturut.Text = “”
End Sub

Private Sub Txtnama_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
txtnpm.SetFocus
End If
End Sub

tugas vb:4

4

Private Sub cbogolongan_Click()

Dim gapok, pajak, tunjangan, total As Variant

Select Case cbogolongan.Text

Case “I”

gapok = 1300000

tunjangan = 150000

Case “II”

gapok = 3000000

tunjangan = 100000

Case “III”

gapok = 3500000

tunjangan = 150000

Case “IV”

gapok = 5000000

tunjangan = 200000

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()

txtnpm.SetFocus

txtnpm.Text = “”

txtnama.Text = “”

cbogolongan.Text = “”

txtgapok.Text = “”

txttunjangan.Text = “”

txtpajak.Text = “”

txttotal.Text = “”

End Sub

 

Private Sub cmdkeluar_Click()

End

End Sub

 

Private Sub cmdlagi_Click()

txtnpm.Text = “”

txtnama.Text = “”

cbogolongan.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

 

Public Sub kosong()

txtnpm.SetFocus

txtnpm.Text = “”

txtnama.Text = “”

cbogolongan.Text = “”

txtgapok.Text = “”

txttunjangan.Text = “”

txtpajak.Text = “”

txttotal.Text = “”

End Sub

 

Private Sub txtnpm_keypress(keyascii As Integer)

If keyascii = 13 Then

txtnama.SetFocus

End If

End Sub