Blog Official Eko Rudianto yang membahas tentang Blogger , Makalah, Artikel , Religi, Wisata dan lain-lain

Wednesday, June 4, 2014

Membuat Program Pembuat Kwitansi VB 6.0

Pertama Buka VB6 kemudian buatlah 1 form dengan menu:
  1. 5 text, 
  2. 11 label dan 
  3. 1 picturebox.
Buatlah 1 module dan masukkan kode dibawah ini:
Public Function Terbilang(x As Double) As String

Dim tampung As Double
Dim teks As String
Dim bagian As String
Dim i As Integer
Dim tanda As Boolean

Dim letak(5)
letak(1) = "ribu "
letak(2) = "juta "
letak(3) = "milyar "
letak(4) = "trilyun "

If (x = 0) Then
Terbilang = "nol"
Exit Function
End If

If (x < 2000) Then
tanda = True
End If
teks = ""
If (x >= 1E+15) Then
Terbilang = "Nilai terlalu besar"
Exit Function
End If
For i = 4 To 1 Step -1
tampung = Int(x / (10 ^ (3 * i)))
If (tampung > 0) Then
bagian = ratusan(tampung, tanda)
teks = teks & bagian & letak(i)
End If
x = x - tampung * (10 ^ (3 * i))
Next
teks = teks & ratusan(x, False)
Terbilang = teks
End Function

Function ratusan(ByVal y As Double, ByVal flag As Boolean) As String
Dim tmp As Double
Dim bilang As String
Dim bag As String
Dim j As Integer

Dim angka(9)
angka(1) = "se"
angka(2) = "dua "
angka(3) = "tiga "
angka(4) = "empat "
angka(5) = "lima "
angka(6) = "enam "
angka(7) = "tujuh "
angka(8) = "delapan "
angka(9) = "sembilan "

Dim posisi(2)
posisi(1) = "puluh "
posisi(2) = "ratus "
bilang = ""
For j = 2 To 1 Step -1
tmp = Int(y / (10 ^ j))
If (tmp > 0) Then
bag = angka(tmp)
If (j = 1 And tmp = 1) Then
y = y - tmp * 10 ^ j
If (y >= 1) Then
posisi(j) = "belas "
Else
angka(y) = "se"
End If

bilang = bilang & angka(y) & posisi(j)
ratusan = bilang
Exit Function
Else
bilang = bilang & bag & posisi(j)
End If
End If
y = y - tmp * 10 ^ j
Next

If (flag = False) Then
angka(1) = "satu "
End If
bilang = bilang & angka(y)
ratusan = bilang
End Function


kemudian klik 2 kali form1 nya dan masukkan kode dibawah ini:
 

Private Sub Command2_Click()
End
End Sub

Private Sub Text1_Change()
Dim angka As Double
Dim teks As String
angka = Val(Text1.Text)
teks = Terbilang(angka)
Text2.Text = teks
Label3 = Text2 & " Rupiah"
If Text1 = "" Then
Text1 = "0"
End If
Label4 = FormatNumber(Text1)
End Sub

Private Sub Text3_Change()
Label2 = Text3
End Sub

Private Sub Text4_Change()
Label1 = Text4
End Sub

Private Sub Text5_Change()
Label9 = Text5
End Sub

Private Sub Text2_Change()
Label11 = Text2
End Sub


Jika ingin melihat contoh aplikasi yg sudah jadi dilahkan
Download Disini
Semoga Bermanfaat !!
http://wisatatelukkiluan.com

G+

0 komentar:

Post a Comment

Tour & Travel Lampung

Copyright © Eko Rudianto Blogs Sponsored by Wisata Teluk Kiluan | Powered by Blogger