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

Source Code


Leave a Reply

Subscribe to Posts | Subscribe to Comments

Popular Post