Tugas VB 28 maret 2012

Private Sub Cboprodi_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtnilai1.SetFocus

End If

End Sub

 

Private Sub Cmdbaru_Click()

txtnpm.SetFocus

txtnpm.Text = ” ”

txtnama.Text = ” ”

Cboprodi.Text = ” ”

txtnilai1.Text = ” ”

txtnilai2.Text = ” ”

txtnilai3.Text = ” ”

txtrata.Text = ” ”

txtHuruf.Text = ” ”

End Sub

 

Private Sub cmdhapus_Click()

Dim hapus

hapus = MsgBox(“Anda    yakin   data    ini akan    dihapus?”, vbQuestion + vbYesNo, “Hapus Data”)

If hapus = vbYes Then

data1.Recordset.Delete

data1.Recordset.MoveLast

Else

MsgBox “Data   tidak   jadi    dihapus!”, vbOKOnly + vbInformation, “Batal Menghapus”

End If

End Sub

 

Private Sub cmdProses_Click()

Dim NA As Integer

Dim HM As String

NA = (Val(txtnilai1.Text) + Val(txtnilai2.Text) + Val(txtnilai3.Text)) / 3

txtrata.Text = NA

 

Select Case txtrata.Text

Case Is >= 80

HM = “A”

Case Is >= 75

HM = “B”

Case Is >= 60

HM = “C”

Case Is >= 45

HM = “D”

Case Is < 45

HM = “E”

End Select

txtHuruf.Text = HM

End Sub

 

 

Private Sub cmdselesai_Click()

Unload Me

End Sub

 

Private Sub cmdsimpan_Click()

data1.Refresh

With data1.Recordset

.AddNew

.Fields(“NPM”) = txtnpm.Text

.Fields(“NAMA”) = txtnama.Text

.Fields(“PRODI”) = Cboprodi.Text

.Fields(“NILAI1”) = txtnilai1.Text

.Fields(“NILAI2”) = txtnilai2.Text

.Fields(“NILAI3”) = txtnilai3.Text

.Fields(“ANGKA”) = txtrata.Text

.Fields(“HURUF”) = txtHuruf.Text

.Update

End With

Cboprodi.Enabled = True

txtnpm.SetFocus

End Sub

 

Private Sub Form_Load()

Cboprodi.AddItem “STRATA SATU”

Cboprodi.AddItem “DIPLOMA TIGA”

Cboprodi.AddItem “DIPLOMA DUA”

Cboprodi.AddItem “DIPLOMA SATU”

End Sub

 

 

Private Sub txtnama_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Cboprodi.SetFocus

End If

End Sub

 

Private Sub txtnilai1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtnilai2.SetFocus

End If

End Sub

 

 

Private Sub txtnilai2_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtnilai3.SetFocus

End If

End Sub

 

Private Sub txtnpm_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtnama.SetFocus

End If

End Sub

Dipublikasi di Uncategorized | Meninggalkan komentar

Latihan VB

Private Sub coKode_Click()

Dim Jk, Hk As String

Select Case coKode.Text

Case “P205”

Jk = “Pentium II 500 Mega Hz”

Hk = “1500000”

Case “P308”

Jk = “Pentium III 800 Mega Hz”

Hk = “2100000”

Case “P310”

Jk = “Pentium III 1.0 Giga Hz”

Hk = “3500000”

Case “P415”

Jk = “Pentium IV 1.5 Giga Hz”

Hk = “4000000”

Case “P417”

Jk = “Pentium IV 1.7 Giga Hz”

Hk = “4200000”

Case “P419”

Jk = “Pentium IV 1.9 Giga Hz”

Hk = “5500000”

End Select

txtJk.Text = Jk

txtHk.Text = Hk

txtJp.SetFocus

End Sub

Private Sub CmdProses_Click()

txtHp.Text = Val(txtJp.Text) * Val(txtHk.Text)

If txtHp.Text > 30000000 Then

txtDs.Text = Val(txtHp.Text) * 0.15

ElseIf txtHp.Text > 25000000 Then

txtDs.Text = Val(txtHp.Text) * 0.1

ElseIf txtHp.Text > 20000000 Then

txtDs.Text = Val(txtHp.Text) * 0.05

ElseIf txtHp.Text > 15000000 Then

txtDs.Text = Val(txtHp.Text) * 0.02

End If

txtHb.Text = Val(txtHp.Text) – Val(txtDs.Text)

End Sub

 

Private Sub Command2_Click()

coKode = “”

txtJk = “”

txtHk = “”

txtJp = “”

txtHp = “”

txtDs = “”

txtHb = “”

coKode.SetFocus

End Sub

 

Private Sub Command3_Click()

End

End Sub

 

Private Sub Form_Load()

coKode.AddItem “P205”

coKode.AddItem “P308”

coKode.AddItem “P310”

coKode.AddItem “P415”

coKode.AddItem “P417”

coKode.AddItem “P419”

End Sub

Dipublikasi di Uncategorized | Meninggalkan komentar

TUGAS VB

Private Sub Combo1_Click()
Dim NM, JUR As String
Select Case Combo1.Text
Case “09100027”
NM = “AFNAN ZALFA SALSABILA A”
JUR = “Sistem Informasi”
Case “10100032”
NM = “UUN HUSTINATUL LATIFAH”
JUR = “Sistem Informasi”
Case “09100035”
NM = “ARI DWI ASIH”
JUR = “Sistem Informasi”
Case “09100030”
NM = “ADILA SARI”
JUR = “Sistem Informasi”
Case “09200048”
NM = “AMALIA AMANAH”
JUR = “Manajemen Informatika”
Case “09200050”
NM = “ANDI SETYA”
JUR = “Manajemen Informatika”
Case “09200051”
NM = “ALDO KUSUMA”
JUR = “Manajemen Informatika”
Case “09300024”
NM = “SASKIA MECHA”
JUR = “Tehnik Informatika”
Case “09300025”
NM = “REDO ANDI”
JUR = “Tehnik Informatika”
Case “09300026”
NM = “REZA L”
JUR = “Tehnik Informatika”
End Select
Text1.Text = NM
Text2.Text = JUR
Text3.SetFocus
End Sub

Private Sub Command1_Click()
Dim NQ, NT, NUTS, NUAS, NA As Integer
Dim HM As String
NQ = Val(Text3.Text)
NT = Val(Text4.Text)
NUTS = Val(Text5.Text)
NUAS = Val(Text6.Text)
NA = (NQ + NT + NUTS + NUAS) / 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.Text = “”
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
Text7.Text = “”
Text8.Text = “”
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Form_Load()
Combo1.AddItem “09100367”
Combo1.AddItem “09200235”
Combo1.AddItem “09300158”
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

Private Sub cmdbatal_Click()
txtnama.SetFocus
txtnama = “”
txtnik = “”
End Sub

Private Sub cmdkeluar_Click()
Unload Me
End Sub

Private Sub cmdlagi_Click()
txtnama.SetFocus
txtnama = “”
txtnik = “”
txtgol = “”
txtks = “”
txts = “”
txtth = “”
txtjb = “”
txtbg = “”
txtgp = “”
txttj = “”
txttg = “”
txtterbilang = “”
End Sub
Private Sub cmdproses_Click()
Dim NIK As String
NIK = Mid(txtnik.Text, 8, 1)
If NIK = “A” Then
txtgol.Text = “A”
txtjb.Text = “MANAGER”
txtgp.Text = “3000000”
txttj.Text = “875000”
ElseIf NIK = “B” Then
txtgol.Text = “B”
txtjb.Text = “KA. SEKSI”
txtgp.Text = “2500000”
txttj.Text = “525000”
ElseIf NIK = “C” Then
txtgol.Text = “C”
txtjb.Text = “STAF”
txtgp.Text = “2000000”
txttj.Text = “325000”
End If
NIK = Left(txtnik.Text, 4)
txtth.Text = NIK
NIK = Mid(txtnik.Text, 6, 1)
If NIK = “S” Then
txtks = “S”
txts.Text = “SINGLE”
ElseIf NIK = “D” Then
txtks.Text = “D”
txts.Text = “DUDA”
ElseIf NIK = “M” Then
txtks.Text = “M”
txts.Text = “MENIKAH”
ElseIf NIK = “J” Then
txtks.Text = “J”
txts.Text = “JANDA”
End If
NIK = Right(txtnik.Text, 3)
If NIK = “EDP” Then
txtbg.Text = “IT UNIT”
ElseIf NIK = “ADM” Then
txtbg.Text = “ADMINISTRASI”
ElseIf NIK = “SPM” Then
txtbg.Text = “SECURITY”
ElseIf NIK = “KEU” Then
txtbg.Text = “ACCOUNTING”
ElseIf NIK = “SDM” Then
txtbg.Text = “GENERAL AFFAIR”
End If
txttg.Text = Val(txtgp.Text) + Val(txttj.Text)
End Sub

Dipublikasi di Uncategorized | Meninggalkan komentar

Tugas Visual Basic

Private Sub chkBold_Click()
‘Font Tebal
If chkBold.Value = 1 Then
lblTeks.FontBold = True
Else
lblTeks.FontBold = False
End If
End Sub

Private Sub chkItalic_Click()
‘Font Italic
If chkItalic.Value = 1 Then
lblTeks.FontItalic = True
Else
lblTeks.FontItalic = False
End If
End Sub

Private Sub chkStrikeout_Click()
‘Font Strikeout
If chkStrikeout.Value = 1 Then
lblTeks.FontStrikethru = True
Else
lblTeks.FontStrikethru = False
End If
End Sub

Private Sub chkUnderline_Click()
‘Font Underline
If chkUnderline.Value = 1 Then
lblTeks.FontUnderline = True
Else
lblTeks.FontUnderline = False
End If
End Sub

Private Sub optBlue_Click()
‘Font Biru
lblTeks.ForeColor = vbBlue

End Sub

Private Sub optGreen_Click()
‘Font Hijau
lblTeks.ForeColor = vbGreen
End Sub

Private Sub optRed_Click()
‘Font Merah
lblTeks.ForeColor = vbRed
End Sub

Private Sub optYellow_Click()
‘Font Kuning
lblTeks.ForeColor = vbYellow

End Sub


Private Sub Cmd_oke_Click()
‘oke edit by benk2
Label_hrf.Caption = Text_tna.Text
End Sub

Private Sub Cmd_sls_Click()
End
End Sub

Private Sub Option_bru_Click()
Label_hrf.ForeColor = vbBlue
End Sub

Private Sub Option_mrh_Click()
Label_hrf.ForeColor = vbRed
End Sub

Private Sub Check_tbl_Click()
Label_hrf.FontBold = Check_tbl.Value
End Sub

Private Sub Check_mrg_Click()
Label_hrf.FontItalic = Check_mrg.Value
End Sub


Private Sub cmdHit_Click()
Dim A, B, C As Double
A = txtHgawal.Text
B = (txtHgawal) * 0.1
Hasil = A – B
txtDisk.Text = B
txtHgakhir.Text = Hasil
End Sub

 

 

 

Private Sub cmdKlr_Click()
End
End Sub

 

 

Private Sub cmdUlg_Click()
txtHgawal.SetFocus
txtHgawal.Text = “”
txtDisk.Text = “”
txtHgakhir.Text = “”
End Sub


Private Sub cmdKeluar_Click()
End
End Sub

 

 

 

Private Sub cmdProses_Click()
Dim Gapok, Tj, Pt, Gk, Pjk, Gjtrm As Double
txtGk.Text = Val(txtgapok.Text) + Val(txtTj.Text) – Val(txtPt.Text)
txtPjk.Text = Val(txtGk.Text) * (0.1)
TxtGjtrm.Text = Val(txtGk.Text) – (txtPjk.Text)
End Sub
Private Sub cmdUlang_Click()
txtgapok.SetFocus
txtgapok.Text = “”
txtTj.Text = “”
txtPt.Text = “”
txtGk.Text = “”
txtPjk.Text = “”
TxtGjtrm.Text = “”
End Sub

 

Private Sub txtgapok_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
txtPt.SetFocus
End If

End Sub


Private Sub CboNpm_Click()
Dim Mhs, Jrs, HM As String
Select Case CboNpm.Text
Case “11100042″
Mhs = “FITRIYANI”
Jrs = “SISTEM INFORMASI”
Case “11200077″
Mhs = “PUSPITA DESI”
Jrs = “MANAJEMEN INFORMATIKA”
Case “11300078″
Mhs = “SEPTIANA”
Jrs = “TEHNIK INFORMATIKA”
Case “11100079″
Mhs = “TOTO ISWANTO”
Jrs = “SISTEM INFORMATIKA”
Case “11200081″
Mhs = “SUPRAPTO”
Jrs = “MANAJEMEN INFORMATIKA”
Case “11300082″
Mhs = “NOVI SUSANTI”
Jrs = “TEHNIK INFORMATIKA”
Case “11100084″
Mhs = “SUKMAWATI”
Jrs = “SISTEM INFORMATIKA”
Case “11200085″
Mhs = “LENI APRIYANI”
Jrs = “MANAJEMEN INFORMATIKA”
Case “11300086″
Mhs = “NURMALITA SARI”
Jrs = “TEHNIK INFORMATIKA”
Case “11100087″
Mhs = “HENI LESTARI”
Jrs = “SISTEM INFORMATIKA”
End Select
txtMhs.Text = Mhs
txtJrs.Text = Jrs
txtQs.SetFocus
End Sub

 

 

 

Private Sub cmdBatal_Click()
CboNpm.SetFocus
CboNpm.Text = “”
txtMhs.Text = “”
txtJrs.Text = “”
txtQs.Text = “”
txtTgs.Text = “”
txtUts.Text = “”
txtUas.Text = “”
txtAkhir.Text = “”
txtHm.Text = “”
End Sub

 

Private Sub cmdKeluar_Click()
End
End Sub

 

Private Sub cmdProses_Click()
Dim NA As Integer
Dim HM As String
QUIS = Val(txtQs.Text)
TUGAS = Val(txtTgs.Text)
UTS = Val(txtUts.Text)
UAS = Val(txtUas.Text)
NA = (QUIS + TUGAS + UTS + UAS) / 4
txtAkhir.Text = NA

 

Select Case txtAkhir.Text
Case Is >= 80
HM = “A”
Case Is >= 70
HM = “B”
Case Is >= 60
HM = “C”
Case Is >= 50
HM = “D”
Case Is < 49
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 “11100087″
End Sub

 

Private Sub txtQs_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtTgs.SetFocus
End If
End Sub

 

Private Sub txtTgs_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

 
Private Sub cmdBatal_Click()
‘Kosongkan Semua
txtKb.Text = “”
txtNb.Text = “”
txtJs.Text = “”
txtSs.Text = “”
txtTj.Text = “”
txtHj.Text = “”
txtTh.Text = “”
txtTerbilang.Text=””
txtKb.SetFocus
End Sub

 

Private Sub cmdKeluar_Click()
End
End Sub
Private Sub cmdProses_Click()
Dim Kb As String
Kb = Right(txtKb.Text, 1)
If Kb = “T” Then
txtNb.Text = “Tape”
txtHj.Text = “275000″
ElseIf Kb = “S” Then
txtNb.Text = “Sound Sistem”
txtHj.Text = “350000″
ElseIf Kb = “C” Then
txtNb.Text = “Compact”
txtHj.Text = “480000″
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
txtSs.Text = Val(txtJs.Text) – Val(txtTj.Text)
txtTh.Text = Val(txtTj.Text) * Val(txtHj.Text)
txtTerbilang.Text = terbilang(Val(txtTh.Text))
End If
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

 

 


Private Sub cmdBatal_Click()
‘Kosongkan Semua
txtKb.Text = “”
txtNb.Text = “”
txtJs.Text = “”
txtSs.Text = “”
txtTj.Text = “”
txtHj.Text = “”
txtTh.Text = “”
txtTerbilang.Text=””
txtKb.SetFocus
End Sub

 

 

 

Private Sub cmdKeluar_Click()
End
End Sub

 

Private Sub cmdProses_Click()
Dim Kb As String
Kb = Right(txtKb.Text, 1)
If Kb = “T” Then
txtNb.Text = “Tape”
txtHj.Text = “275000″
ElseIf Kb = “S” Then
txtNb.Text = “Sound Sistem”
txtHj.Text = “350000″
ElseIf Kb = “C” Then
txtNb.Text = “Compact”
txtHj.Text = “480000″
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
txtSs.Text = Val(txtJs.Text) – Val(txtTj.Text)
txtTh.Text = Val(txtTj.Text) * Val(txtHj.Text)
txtTerbilang.Text = terbilang(Val(txtTh.Text))
End If
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

 


Private Sub cmdBt_Click()
txtMnk.SetFocus
txtMnk.Text = “”
txtMn.Text = “”
txtGl.Text = “”
txtKd.Text = “”
txtSt.Text = “”
txtTh.Text = “”
txtJb.Text = “”
txtBg.Text = “”
txtGp.Text = “”
txtTj.Text = “”
txtTg.Text = “”
txtTerbilang.Text = “”
End Sub

 

 

 

Private Sub cmdKl_Click()
End
End Sub

 

Private Sub cmdLg_Click()
txtMnk.SetFocus
txtMnk.Text = “”
txtMn.Text = “”
txtGl.Text = “”
txtKd.Text = “”
txtSt.Text = “”
txtTh.Text = “”
txtJb.Text = “”
txtBg.Text = “”
txtGp.Text = “”
txtTj.Text = “”
txtTg.Text = “”

 

End Sub

 

Private Sub cmdPrs_Click()
txtTh.Text = Mid(txtMn.Text, 5, 4)
Dim mn&nbsp; As String
mn = Mid(txtMn.Text, 9, 1)
If mn = “A” Then
txtGl.Text = “A”
txtJb.Text = “Manager”
txtGp.Text = “3000000″
txtTj.Text = “875000″
ElseIf mn = “B” Then
txtGl.Text = “B”
txtJb.Text = “Ka Seksi”
txtGp.Text = “2500000″
txtTj.Text = “525000″
ElseIf mn = “C” Then
txtGl.Text = “C”
txtJb.Text = “Staff”
txtGp.Text = “2000000″
txtTj.Text = “325000″
End If
mn = Right(txtMn, 1)
If mn = “M” Then
txtKd.Text = “M”
txtSt.Text = “Menikah”
ElseIf mn = “S” Then
txtKd.Text = “S”
txtSt.Text = “Single”
ElseIf mn = “D” Then
txtKd.Text = “D”
txtSt.Text = “Duda”
ElseIf mn = “J” Then
txtKd.Text = “J”
txtSt.Text = “Janda”
End If
mn = Left(txtMn.Text, 3)
If mn = “SDM” Then
txtBg.Text = “General Affair”
ElseIf mn = “KEU” Then
txtBg.Text = “Accounting”
ElseIf mn = “ADM” Then
txtBg.Text = “Administrasi”
ElseIf mn = “SPM” Then
txtBg.Text = “Security”
ElseIf mn = “EDP” Then
txtBg.Text = “IT Unit”
End If
txtTg.Text = Val(txtGp) + (txtTj)
txtTerbilang.Text = terbilang(Val(txtTg.Text))
End Sub

 

Private Sub txtMnk_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtMn.SetFocus
End If
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

 


Dipublikasi di Uncategorized | Meninggalkan komentar

Hello world!

Welcome to WordPress.com. After you read this, you should delete and write your own post, with a new title above. Or hit Add New on the left (of the admin dashboard) to start a fresh post.

Here are some suggestions for your first post.

  1. You can find new ideas for what to blog about by reading the Daily Post.
  2. Add PressThis to your browser. It creates a new blog post for you about any interesting  page you read on the web.
  3. Make some changes to this page, and then hit preview on the right. You can always preview any post or edit it before you share it to the world.
Dipublikasi di Uncategorized | 1 Komentar