Download Program Digit Microsoft Visual Basic 6.0
1. Buka Aplikasi Visual Basic 6.0
2. Desain Form Seperti Ini
3. Tambahkan Modul
Caranya klik kanan pada Project1 pilih add-Module-Open
Klik dua kali Module1, copy code berikut dan pastekan
Global Digit
Public Function DIGIT_NUMBER(vNumber As Double) As String
Dim sNumber As String
Dim sDigit As String
Dim iX As Byte
Dim iCount As Byte
sNumber = Trim(Str(vNumber))
sDigit = ""
Digit = ""
iCount = 1
For iX = 0 To Len(sNumber) - 1 Step 1
sDigit = Mid(sNumber, Len(sNumber) - iX, 1) & sDigit
iCount = iCount + 1
If iCount = 4 Then
If iX < Len(sNumber) - 1 Then
sDigit = "." & sDigit
iCount = 1
End If
End If
Next iX
DIGIT_NUMBER = sDigit
Digit = sDigit
End Function
4. Ubah Property
Form1 - Caption - Digit Indonesia
Label1 - Caption - Masukkan Angka (Anda tidak bisa memasukkan selain angka)
Text1 - Text - 0
Command1 - Caption - Tampilkan
Label2 - Caption - Hasil
Text2 - Text - 0
5. Copy code berikut lalu klik View Code dan pastekan
Private Sub Command1_Click()
DIGIT_NUMBER (Text1.Text)
Text2.Text = Digit
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Then
KeyAscii = 8
Exit Sub
End If
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
Text1.SetFocus
Exit Sub
End If
End Sub
6. Jalankan Program dengan menekan F5, maka tampilannya akan seperti ini
Download Program Digit Microsoft Visual Basic 6.0
SELAMAT MENCOBA...!!!
No comments:
Post a Comment