DATA MAHASISWA

Capture

Private Sub cmdbatal_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
txtjurusan.Text = “”
txtstudi.Text = “”
txttahun.Text = “”
txtnurut.Text = “”
txtbp.Text = “”
txtterbilang.Text = “”
End Sub

Private Sub cmdkeluar_Click()
Dim testmsg As Integer
testmsg = MsgBox(“anda yakin mau keluar”, vbYesNo)
End
End Sub

Private Sub cmdlagi_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
txtjurusan.Text = “”
txtstudi.Text = “”
txttahun.Text = “”
txtnurut.Text = “”
txtbp.Text = “”
txtterbilang.Text = “”
End Sub
Private Sub cmdproses_Click()
Dim s As String
txttahun.Text = “20” & Mid(txtnpm.Text, 1, 2)
txtnurut = Mid(txtnpm.Text, 6, 3)
s = Mid(txtnpm.Text, 4, 2)
If s = “01” Then
txtstudi.Text = “strata satu”
txtbp.Text = “1950000”
ElseIf s = “02” Then
txtstudi.Text = “Diploma Empat”
txtbp.Text = “1750000”
ElseIf s = “03” Then
txtstudi.Text = “Diploma Tiga”
txtbp.Text = “1650000”
ElseIf s = “04” Then
txtstudi.Text = “Diploma Dua”
txtbp.Text = “1450000”
End If
s = Mid(txtnpm.Text, 3, 1)
If s = “1” Then
txtjurusan.Text = “sistem informasi”
ElseIf s = “2” Then
txtjurusan.Text = “tehnik informasi”
ElseIf s = “3” Then
txtjurusan.Text = “manajemen informasi”
ElseIf s = “4” Then
txtjurusan.Text = “manajemen dan komp.akuntansi”
End If
End Sub

Private Sub txtbp_Change()
txtterbilang = terbilang(Val(txtbp.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)) & “”
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)) & ” ”
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

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s