Tugas Semester 2

tugas baru

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()
Txtnama.SetFocus
Adodc1.Recordset.AddNew

End Sub

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

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

Private Sub Command5_Click()
End
End Sub

Private Sub Form_Activate()
Txtnama.SetFocus
Txtnama.Text = “”
txtnpm.Text = “”
txtjr.Text = “”
txtnurut.Text = “”
txtps.Text = “”
txttm.Text = “”
End Sub

tugas VB : No. 6

properti test

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

Label2.ForeColor = vbBlue

End Sub

 

Private Sub Option2_Click()

Label2.ForeColor = vbRed

End Sub

 

tugas VB : No 9

quis 3

Private Sub cmdBATAL_Click()

txtNAMA.SetFocus

txtGOLONGAN.Text = “”

txtKODESTATUS.Text = “”

txtSTATUS.Text = “”

txtTAHUN.Text = “”

txtJABATAN.Text = “”

txtBAGIAN.Text = “”

txtGAJIPOKOK.Text = “”

txtTUNJANGAN.Text = “”

txtTOTAL.Text = “”

txtNAMA.Text = “”

txtNIK.Text = “”

End Sub

 

Private Sub cmdKELUAR_Click()

End

End Sub

 

Private Sub cmdLAGI_Click()

txtNAMA.SetFocus

txtGOLONGAN.Text = “”

txtKODESTATUS.Text = “”

txtSTATUS.Text = “”

txtTAHUN.Text = “”

txtJABATAN.Text = “”

txtBAGIAN.Text = “”

txtGAJIPOKOK.Text = “”

txtTUNJANGAN.Text = “”

txtTOTAL.Text = “”

txtNAMA.Text = “”

txtNIK.Text = “”

End Sub

 

Private Sub cmdPROSES_Click()

Dim gl, ks, s As String

Dim th, jb, bg As Variant

Dim gp, tnj, ttal As Long

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

txtGOLONGAN.Text = gl

txtJABATAN.Text = jb

txtGAJIPOKOK.Text = gp

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

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

txtKODESTATUS.Text = ks

txtSTATUS.Text = s

txtTOTAL.Text = Val(txtGAJIPOKOK.Text) + Val(txtTUNJANGAN.Text)

End Sub

 

Private Sub txtNAMA_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtNIK.SetFocus

End If

End Sub

tugas VB : No 8

quis 2

Private Sub cmdbatal_Click()

cbo.SetFocus

cbo.Text = “”

txtjudul.Text = “”

txtpengarang.Text = “”

txttahun.Text = “”

txtpenerbit.Text = “”

txtharga.Text = “”

End Sub

 

Private Sub cmdkeluar_Click()

End

End Sub

 

Private Sub cmdlagi_Click()

cbo.SetFocus

cbo.Text = “”

txtjudul.Text = “”

txtpengarang.Text = “”

txttahun.Text = “”

txtpenerbit.Text = “”

txtharga.Text = “”

End Sub

 

Private Sub cmdproses_Click()

Dim jb, pg, tt As String

Dim pt, hg As Variant

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

txtjudul.Text = jb

txtpengarang.Text = pg

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

txtpenerbit.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 : No 7

quis 1

Private Sub cmdbatal_Click()

cbo.SetFocus

cbo.Text = “”

txtjudul.Text = “”

txtpengarang.Text = “”

txttahun.Text = “”

txtpenerbit.Text = “”

txtharga.Text = “”

End Sub

 

Private Sub cmdkeluar_Click()

End

End Sub

 

Private Sub cmdlagi_Click()

cbo.SetFocus

cbo.Text = “”

txtjudul.Text = “”

txtpengarang.Text = “”

txttahun.Text = “”

txtpenerbit.Text = “”

txtharga.Text = “”

End Sub

 

Private Sub cmdproses_Click()

Dim jb, pg, tt As String

Dim pt, hg As Variant

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

txtjudul.Text = jb

txtpengarang.Text = pg

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

txtpenerbit.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 : No 5

nilai huruf

Private Sub cbo_Click()

Dim nama, jurusan, NM As String

Select Case cbo.Text

Case “12100412”

nama = “Hendri Setiawan”

jurusan = “Sistem Iformasi”

Case “12201111”

nama = “Fajar Deswantoro”

jurusan = “manajemen informatika”

Case “12100413”

nama = “herianto”

jurusan = “sistem informasi”

End Select

txtnama.Text = nama

txtjurusan.Text = jurusan

txtquis.SetFocus

End Sub

 

Private Sub cmdBATAL_Click()

cbo.SetFocus

txtnama = “”

txtjurusan = “”

txtquis = “”

txttugas = “”

txtuts = “”

txtuas = “”

txtNA = “”

txthuruf = “”

End Sub

 

Private Sub cmdKELUAR_Click()

End

End Sub

 

Private Sub cmdPROSES_Click()

Dim na As Integer

Dim hm As String

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

txthuruf.Text = hm

End Sub

 

Private Sub Form_Load()

cbo.AddItem “12100414”

cbo.AddItem “12100413”

cbo.AddItem “12201111”

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 : No 4

nidn

Private Sub Cbo_Click()

Dim gapok, pajak, tunjangan, total As Variant

Select Case Cbo.Text

Case “I”

gapok = 1500000

tunjangan = 150000

Case “II”

gapok = 2000000

tunjangan = 20000

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

Text3.Text = gapok

Text4.Text = tunjangan

Text5.Text = pajak

Text6.Text = total – pajak

End Sub

 

Private Sub cmdBATAL_Click()

kosong

End Sub

 

Private Sub cmdKELUAR_Click()

End

End Sub

 

Private Sub cmdLAGI_Click()

kosong

End Sub

 

Private Sub Form_Load()

Cbo.AddItem “I”

Cbo.AddItem “II”

Cbo.AddItem “III”

Cbo.AddItem “IV”

End Sub

Public Sub kosong()

Text1.SetFocus

Text1.Text = “”

Text2.Text = “”

Text3.Text = “”

Text4.Text = “”

Text5.Text = “”

Text6.Text = “”

End Sub

 

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Text2.SetFocus

End If

End Sub

tugas VB : No 3

jurusan mahasiswa

Private Sub Command1_Click()

Dim a As String

txttahun.Text = “20” & Left(txtNPM.Text, 2)

a = Mid(txtNPM.Text, 3, 1)

If a = “1” Then

jr = “sistem informasi”

ElseIf a = “2” Then

jr = “manajemen informatika”

ElseIf a = “3” Then

jr = ” teknik informatika”

ElseIf a = “4” Then

jr = “komputer akuntansi”

End If

txtjurusan.Text = jr

a = Mid(txtNPM.Text, 4, 2)

If a = “01” Then

ps = “strata satu”

ElseIf a = “02” Then

ps = “diploma empat”

ElseIf ps = “03” Then

ps = “diploma tiga”

ElseIf ps = “04” Then

ps = “diploma dua”

End If

txtprogram.Text = ps

txtno.Text = Right(txtNPM.Text, 3)

End Sub

 

Private Sub Command2_Click()

txtnama.SetFocus

txtnama.Text = “”

txtNPM.Text = “”

txtjurusan.Text = “”

txtprogram.Text = “”

txttahun.Text = “”

txtno.Text = “”

End Sub

 

Private Sub Command3_Click()

txtnama.SetFocus

txtnama.Text = “”

txtNPM.Text = “”

txtjurusan.Text = “”

txtprogram.Text = “”

txttahun.Text = “”

txtno.Text = “”

End Sub

 

Private Sub Command4_Click()

End

End Sub

 

Private Sub txtnama_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtNPM.SetFocus

End If

End Sub

tugas VB : No 2

gaji pegawai

Private Sub cmdKeluar_Click()

End

End Sub

 

Private Sub cmdProses_Click()

Dim a, b, c, d, e, f As Double

txtgajikotor.Text = Val(txtgaji.Text) + Val(txttunjangan.Text) – Val(txtpotongan.Text)

txtpajak.Text = Val(txtgajikotor.Text) * (0.1)

txtgajibersih.Text = Val(txtgajikotor.Text) – Val(txtpajak.Text)

End Sub

 

Private Sub cmdUlang_Click()

txtgaji.SetFocus

txtgaji.Text = “”

txttunjangan.Text = “”

txtpotongan.Text = “”

txtgajikotor.Text = “”

txtpajak.Text = “”

txtgajibersih.Text = “”

End Sub

 

Private Sub txtgaji_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txttunjangan.SetFocus

End If

End Sub

 

Private Sub txttunjangan_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtpajak.SetFocus

End If

 

End Sub

tugas VB : No 1

check box

Private Sub checkbold_Click()

If checkbold.Value = 1 Then

labeljudul.FontBold = True

Else

labeljudul.FontBold = False

End If

End Sub

 

Private Sub checkitalic_Click()

If checkitalic.Value = 1 Then

labeljudul.FontItalic = True

Else

labeljudul.FontItalic = False

End If

End Sub

 

Private Sub checkstrikeout_Click()

If checkstrikeout.Value = 1 Then

labeljudul.FontStrikethru = True

Else

labeljudul.FontStrikethru = False

End If

End Sub

 

Private Sub checkunderline_Click()

If checkunderline.Value = 1 Then

labeljudul.FontUnderline = True

Else

labeljudul.FontUnderline = False

End If

End Sub

 

Private Sub cmdexit_Click()

End

End Sub

 

Private Sub optionblue_Click()

labeljudul.ForeColor = vbBlue

End Sub

 

Private Sub optiongreen_Click()

labeljudul.ForeColor = vbGreen

End Sub

 

Private Sub optionred_Click()

labeljudul.ForeColor = vbRed

End Sub

 

Private Sub optionyellow_Click()

labeljudul.ForeColor = vbYellow

End Sub