Semoga bisa membantu sedikit. Seperti inikah yang
dimaksud TS ??
File download :
http://rapidshare.com/files/19772494/ValidasiInput.zip.html
===================COPY=======================
'deklarasi di General Declaration
Dim jmlKoma As Integer
Dim ctr As Boolean 'Sebagai penanda agar tanda
koma(,) utk decimal hanya bisa diinput sekali
Private Sub Form_Load()
ctr = True
jmlKoma = 0
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
'msgbox keyascii
If Len(Text1.Text) > 0 Then
For i = 1 To Len(Text1.Text)
If Mid(Text1.Text, 1, 1) = "," Then
ctr = False
End If
Next i
Else
ctr = True
End If
If (KeyAscii < vbKey0 Or KeyAscii > vbKey9) Then
If KeyAscii < 8 Then
MsgBox "Masukkan format yang benar"
KeyAscii = 0
ElseIf KeyAscii > 8 Then
If KeyAscii = 44 And ctr = True Then
ctr = False
Else
MsgBox "Masukkan format yang benar"
KeyAscii = 0
End If
End If
End If
End Sub
=========================END OF COPY ==============
--- "Karman ." <[EMAIL PROTECTED]> wrote:
> Coba pake Ascii Numbernya aja... Jangan pake
> vbkey... Pasti Bisa
>
>
> ----- Original Message ----
> From: Don Rudy <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Tuesday, March 6, 2007 2:22:28 PM
> Subject: [ITCENTER] [IT-CENTER]Tanya - Visual Basic
> 6.0
>
> Dear All, saya perlu bantuan nich. Semoga ada yang
> mau bantu.
> Saya sedang membuat aplikasi payroll di kantor
> menggunakan Visual Basic.
> Untuk input angka saya menggunakan KeyAscii supaya
> karakter lain(selain
> angka) tidak bisa diinput. Masalahnya adalah angka
> yang dimasukkan
> seharusnya bisa Decimal(dengan menggunakan "."),
> saya sudah mencoba
> menggunakan VbKeyDecimal tapi tidak berfungsi...
> Saya inputkan "." tetap muncul MsgBox, berikut ini
> saya sertakan code-nya.
> Thanks.
>
> Private Sub txt_jamlembur_ KeyPress( KeyAscii As
> Integer)
> On Error Resume Next
> If ((KeyAscii >= vbKey0) And (KeyAscii <= vbKey9))
> Or (KeyAscii =
> vbKeyBack) Or (KeyAscii = vbKeyDecimal) Then
> Exit Sub
> Else
> MsgBox ("Anda harus memasukkan angka."), vbOKOnly +
> vbExclamation,
> "Peringatan"
> KeyAscii = vbKeyBack
> End If
> On Error GoTo 0
> End Sub
>
> [Non-text portions of this message have been
> removed]
>
>
>
>
>
>
>
____________________________________________________________________________________
> Don't get soaked. Take a quick peak at the forecast
> with the Yahoo! Search weather shortcut.
> http://tools.search.yahoo.com/shortcuts/#loc_weather
>
> [Non-text portions of this message have been
> removed]
>
>
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121
--
www.itcenter.or.id - Komunitas Teknologi Informasi Indonesia
Gabung, Keluar, Mode Kirim : [EMAIL PROTECTED]
## Jobs: itcenter.or.id/jobs ## Bursa: itcenter.or.id/bursa ##
## Jaket ITCENTER tersedia di http://shop.itcenter.or.id
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ITCENTER/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ITCENTER/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/