1. Tugas 1

NAMA : RINI ASTUTI
NPM : 11100113

1.FONT COLOR & FONT STYLE

BEFORE

AFTER

KODE PROGRAM

Private Sub OptRed_Click()
lblTeks.ForeColor = vbRed
End Sub

Private Sub Optgreen_Click()
lblTeks.ForeColor = vbGreen
End Sub

Private Sub OptBlue_Click()
lblTeks.ForeColor = vbBlue
End Sub

Private Sub OptYellow_Click()
lblTeks.ForeColor = vbYellow
End Sub

Private Sub ChkBold_Click()
If chkBold.Value = 1 Then
lblTeks.FontBold = True
Else
lblTeks.FontBold = False
End If
End Sub

Private Sub Chkitalic_Click()
If Chkitalic.Value = 1 Then
lblTeks.FontItalic = True
Else
lblTeks.FontItalic = False
End If
End Sub

Private Sub Chkunderline_Click()
If Chkunderline.Value = 1 Then
lblTeks.FontUnderline = True
Else
lblTeks.FontUnderline = False
End If
End Sub

Private Sub Chkstrike_Click()
If chkstrike.Value = 1 Then
lblTeks.FontStrikethru = True
Else
lblTeks.FontStrikethru = False
End If
End Sub

Private Sub Cmdexit_Click()
Unload Me
End Sub

2.TEXT NAMA

BEFORE

AFTER

KODE PROGRAM

Private Sub Chkmiring_Click()
Lbl2.FontItalic = Chkmiring.Value
End Sub

Private Sub Chktebal_Click()
Lbl2.FontBold = Chktebal.Value
End Sub

Private Sub Cmdok_Click()
Lbl2.Caption = Txtnama.Text
End Sub

Private Sub Cmdselesai_Click()
Unload Me
End Sub

Private Sub Optbiru_Click()
Lbl2.ForeColor = vbBlue
End Sub

Private Sub Optmerah_Click()
Lbl2.ForeColor = vbRed
End Sub

3. HARGA DISKON

BEFORE

AFTER

KODE PROGRAM

Private Sub Cmdhitung_Click()
Dim A, B, C As Double
TextB.Text = Val(TextA.Text) * 0.1
TextC.Text = Val(TextA.Text) – Val(TextB.Text)
End Sub

Private Sub Cmdkeluar_Click()
Unload Me
End Sub

Private Sub Cmdulang_Click()
TextA.Text = ” ”
TextB.Text = ” ”
TextC.Text = ” ”
End Sub

Private Sub TextA_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TextB.SetFocus
End If
End Sub

4.PERHITUNGAN GAJI

BEFORE

AFTER

KODE PROGRAM

Private Sub Cmdkeluar_Click()
Unload Me
End Sub

Private Sub Cmdproses_Click()
Dim A, B, C, D, E, F As Double

TextD.Text = Val(TextA.Text) + Val(TextB.Text) – Val(TextC.Text)
TextE.Text = Val(TextD.Text) * (0.1)
Textf.Text = Val(TextD.Text) – Val(TextE.Text)
End Sub

Private Sub Cmdulang_Click()
TextA.Text = ” ”
TextB.Text = ” ”
TextC.Text = ” ”
TextD.Text = ” ”
TextE.Text = ” ”
Textf.Text = ” ”
End Sub

Private Sub TextA_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TextB.SetFocus
End If
End Sub

Private Sub TextB_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TextC.SetFocus
End If
End Sub

5. HURUF MUTU

BEFORE

AFTER

KODE PROGRAM

Private Sub Cbonpm_Click()
Dim Nama, Jurusan As String

Select Case Cbonpm.Text
Case “11100042”
Nama = “FITRIYANI”
Jurusan = “SISTEM INFORMASI”

Case “11200077”
Nama = “PUSPITA DEWI”
Jurusan = “MANAJEMEN INFORMATIKA”

Case “11300078”
Nama = “SEPTIANA”
Jurusan = “TEHNIK INFORMATIKA”

Case “11100079”
Nama = “TOTO ISWANTO”
Jurusan = ” SISTEM INFORMASI”

Case “11200081”
Nama = “SUPRAPTO”
Jurusan = “MANAJEMEN INFORMATIKA”

Case “11300082”
Nama = “NOVI SUSANTI”
Jurusan = “TEHNIK INFORMATIKA”

Case “11100084”
Nama = “SUKMAWATI”
Jurusan = “SISTEM INFORMASI”

Case “11200085”
Nama = “LENI APRIYANI”
Jurusan = “MANAJEMEN INFORMATIKA”

Case “11300086”
Nama = “NURMALITA SARI”
Jurusan = “TEHNIK INFORMATIKA”

Case “11200087”
Nama = “HENI LESTARI”
Jurusan = “MANAJEMEN INFORMATIKA”
End Select

Txtnama.Text = Nama
Txtjurusan.Text = Jurusan
Txtquis.SetFocus
End Sub

Private Sub Cmdbatal_Click()
Cbonpm.SetFocus
Cbonpm.Text = ” ”
Txtnama.Text = ” ”
Txtjurusan.Text = ” ”
Txtquis.Text = ” ”
Txttugas.Text = ” ”
Txtuts.Text = ” ”
Txtuas.Text = ” ”
Txtna.Text = ” ”
Txthm.Text = ” ”
End Sub

Private Sub Cmdkeluar_Click()
Unload Me
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
Txthm.Text = Hm

End Sub

Private Sub Form_Load()
Cbonpm.AddItem "11100042"
Cbonpm.AddItem "11200077"
Cbonpm.AddItem "11300078"
Cbonpm.AddItem "11100079"
Cbonpm.AddItem "11200081"
Cbonpm.AddItem "11300082"
Cbonpm.AddItem "11100084"
Cbonpm.AddItem "11200085"
Cbonpm.AddItem "11300086"
Cbonpm.AddItem "11200087"
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

6.TIKET KERETA API

BEFORE

AFTER

KODE PROGRAM

Private Sub cmdKeluar_Click()
Unload Me
End Sub

Private Sub cmdLagi_Click()
txtKT.SetFocus
txtKT.Text = “”
txtHT.Text = “”
txtJK.Text = “”
txtJB.Text = “”
txtJT.Text = “”
txtTP.Text = “”
End Sub

Private Sub cmdProses_Click()
Dim KT As String

KT = Left(txtKT.Text, 3)
If KT = “BIM” Then
txtHT.Text = 50000
txtJK.Text = “BIMA”
txtJB.Text = “16.00”

ElseIf KT = “EKO” Then
txtHT.Text = 35000
txtJK.Text = “EKONOMI”
txtJB.Text = “19.00”

ElseIf KT = “MUT” Then
txtHT.Text = 23000
txtJK.Text = “MUTIARA”
txtJB.Text = “17.00”

ElseIf KT = “SEN” Then
txtHT.Text = 15000
txtJK.Text = “SENJA”
txtJB.Text = “20.00”
End If
txtJT.SetFocus
End Sub

Private Sub Form_Activate()
txtKT.SetFocus
txtKT.Text = “”
txtHT.Text = “”
txtJK.Text = “”
txtJB.Text = “”
txtJT.Text = “”
txtTP.Text = “”
End Sub

Private Sub txtJT_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtTP = Val(txtHT.Text) * Val(txtJT.Text)
End If

End Sub

7. STOCK BARANG

BEFORE

AFTER

KODE PROGRAM

Private Sub cmdbatal_Click()
Txtkb.SetFocus
Txtkb.Text = ” ”
txtnb.Text = ” ”
txtjs.Text = ” ”
txttj.Text = ” ”
txthj.Text = ” ”
txtth.Text = ” ”
txtss.Text = ” ”

End Sub

Private Sub cmdkeluar_Click()
Unload Me

End Sub

Private Sub cmdproses_Click()
Dim NM As String

txtnb.Text = Right(Txtkb.Text, 1)
NM = Right(Txtkb.Text, 1)

If NM = “S” Then
txtnb.Text = “sound sistem”
txthj.Text = 350000
ElseIf NM = “C” Then
txtnb.Text = “Compact”
txthj.Text = 480000
ElseIf NM = “T” Then
txtnb.Text = “Tape”
txthj.Text = 275000
End If
txtjs.SetFocus
End Sub

Private Sub txtjs_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttj.SetFocus
End If

End Sub

Private Sub txttj_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Dim JS, TJ As Integer

txtss.Text = Val(txtjs.Text) – Val(txttj.Text)
txtth.Text = Val(txttj.Text) * Val(txthj.Text)
txtth.SetFocus
End If

End Sub

Private Sub Txtth_Change()
Txtterbilang.Text = terbilang(Val(txtth.Text))
End Sub
Private Function baca(X As Integer) As String
Dim i As Long
Dim ratus(9) As String
Dim belas(9) As String
Dim puluh(9) As String
Dim satuan(9) As String
Dim sbaca As String
satuan(1) = “satu”
satuan(2) = “dua”
satuan(3) = “tiga”
satuan(4) = “empat”
satuan(5) = “lima”
satuan(6) = “enam”
satuan(7) = “tujuh”
satuan(8) = “delapan”
satuan(9) = “sembilan”
For i = 1 To 9
If i = 1 Then
puluh(i) = “sepuluh”
Else
puluh(i) = satuan(i) & ” puluh”
End If
Next
For i = 1 To 9
If i = 1 Then
belas(i) = “sebelas”
Else
belas(i) = satuan(i) & ” belas”
End If
Next
For i = 1 To 9
If i = 1 Then
ratus(i) = “seratus”
Else
ratus(i) = satuan(i) & ” ratus”
End If
Next
If X >= 100 Then
sbaca = ratus(Val(Mid(Str(X), 2, 1)))
X = Val(Mid(Str(X), 3, 2))
End If
If X >= 20 Or X = 10 Then
sbaca = sbaca & ” ” & puluh(Val(Mid(Str(X), 2, 1)))
X = Val(Mid(Str(X), 3, 1))
Else
If X > 10 Then
sbaca = sbaca & ” ” & belas(Val(Mid(Str(X), 3, 1)))
X = -1
End If
End If
If X >= 1 Then
sbaca = sbaca & ” ” & satuan(Val((Str(X))))
End If
baca = sbaca
End Function
Function terbilang(X As Currency) As String
Dim ribu, juta, milyar, trilyun, ratusan As Integer
Dim sterbilang As String
Dim ptext As Byte
sterbilang = “”
If Val(X) = 1000000000000# Then
ptext = Len(Str(X)) – 13
trilyun = Val(Mid(Str(X), 2, ptext))
sterbilang = sterbilang & ” ” & baca(Val(trilyun)) & ” trilyun”
X = Val(Mid(Str(X), ptext + 2, 12))
End If
If X >= 1000000000 Then
ptext = Len(Str(X)) – 10
milyar = Val(Mid(Str(X), 2, ptext))
sterbilang = sterbilang & ” ” & baca(Val(milyar)) & ” milyar”
X = Val(Mid(Str(X), ptext + 2, 9))
End If
If X >= 1000000 Then
ptext = Len(Str(X)) – 7
juta = Val(Mid(Str(X), 2, ptext))
sterbilang = sterbilang & ” ” & baca(Val(juta)) & ” juta”
X = Val(Mid(Str(X), ptext + 2, 6))
End If
If X >= 1000 Then
ptext = Len(Str(X)) – 4
ribu = Val(Mid(Str(X), 2, ptext))
If ribu = 1 Then
sterbilang = “seribu”
Else
sterbilang = sterbilang & ” ” & baca(Val(ribu)) & ” ribu”
End If
X = Val(Mid(Str(X), ptext + 2, 3))
End If
sterbilang = sterbilang & ” ” & baca(Val(X))
terbilang = Trim(sterbilang) & ” rupiah”
End Function

8. NIK

BEFORE

AFTER

KODE PROGRAM

Private Sub cmdbatal_Click()
txtnama.SetFocus
txtnama.Text = ” ”
txtnik.Text = ” ”
Txtgol.Text = ” ”
txtks.Text = ” ”
txtst.Text = ” ”
txtth.Text = ” ”
txtjb.Text = ” ”
txtbag.Text = ” ”
txtgp.Text = ” ”
txttun.Text = ” ”
txttg.Text = ” ”
End Sub

Private Sub cmdkeluar_Click()
Unload Me
End Sub

Private Sub cmdlagi_Click()
txtnama.SetFocus
txtnama.Text = ” ”
txtnik.Text = ” ”
Txtgol.Text = ” ”
txtks.Text = ” ”
txtst.Text = ” ”
txtth.Text = ” ”
txtjb.Text = ” ”
txtbag.Text = ” ”
txtgp.Text = ” ”
txttun.Text = ” ”
txttg.Text = ” ”

End Sub

Private Sub cmdproses_Click()
Dim NK As String

Txtgol.Text = Mid(txtnik.Text, 9, 1)
NK = Mid(txtnik.Text, 9, 1)
If NK = “A” Then
Txtgol.Text = “A”
txtjb.Text = “manajer”
txtgp.Text = “3000000”
txttun.Text = “875000”
ElseIf NK = “B” Then
Txtgol.Text = “B”
txtjb.Text = “Ka.seksi”
txtgp.Text = “2500000”
txttun.Text = “525000”
ElseIf NK = “C” Then
Txtgol.Text = “C”
txtjb.Text = “staft”
txtgp.Text = “2000000”
txttun.Text = “325000”
End If
txttun.SetFocus

NK = Mid(txtnik.Text, 5, 4)
txtth.Text = NK

NK = Left(txtnik.Text, 3)
If NK = “KEU” Then
txtbag.Text = “Accounting”
ElseIf NK = “ADM” Then
txtbag.Text = “Administrasi”
ElseIf NK = “SDM” Then
txtbag.Text = “General Affair”
ElseIf NK = “EDP” Then
txtbag.Text = “It Unit”
ElseIf NK = “SPM” Then
txtbag.Text = “Security”
End If

NK = Right(txtnik.Text, 1)
If NK = “M” Then
txtks.Text = “M”
txtst.Text = “Menikah”
ElseIf NK = “S” Then
txtks.Text = “S”
txtst.Text = “Single”
ElseIf NK = “D” Then
txtks.Text = “D”
txtst.Text = “Duda”
ElseIf NK = “J” Then
txtks.Text = “J”
txtst.Text = “Janda”
End If

txttg = Val(txtgp.Text) + Val(txttun.Text)
txttg.SetFocus
End Sub

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

Private Sub txtnik_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdproses.SetFocus
End If
End Sub

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

End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

  • %d bloggers like this: