- Back to Home »
- VB6 »
- [VB6] Hanya angka yang boleh di input
Posted by : Unknown
Sunday, 19 January 2014
Ini adalah cara agar sebuah Textbox di Visual basic 6 hanya bisa di input oleh angka. kasus ini sudah sering dialami oleh banyak programmer
Format
Private Sub [TextBox.Name]_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then KeyAscii = 0
End Sub
Contoh
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then KeyAscii = 0
End Sub