Home > Visual Basic 6 > TextBox Hanya Menerima Input Huruf

TextBox Hanya Menerima Input Huruf

Source code berikut untuk memfungsikan textbox hanya bisa menerima input huruf. Bisa digunakan untuk input nama atau yang lainnya yang tidak menggunakan angka.

Yang diperlukan :
1 Form
1 TextBox

Source code pada Form :

Public Sub HanyaHuruf(ByRef KeyAscii As Integer)
    If Not (KeyAscii >= Asc("a") & Chr(13) And KeyAscii <= Asc("z") & Chr(13) Or (KeyAscii >= Asc("A") & Chr(13) And KeyAscii <= Asc("Z") & Chr(13) Or KeyAscii = vbKeyBack Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeySpace)) Then
        KeyAscii = 0
    End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    HanyaHuruf KeyAscii
End Sub

Download Source Code

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: