Tools Links Login

Allow only numbers in a textbox!

This program won't allow any other characters in a textbox then numbers and it allows you to use your Backspace key.

Original Author: RayDance

Code

Private Sub text1_KeyPress(KeyAscii As Integer)
  Dim Numbers As Integer
  Dim Msg As String
  
  Numbers = KeyAscii
  
  If ((Numbers < 48 Or Numbers > 57) And Numbers <> 8) Then
   Msg = MsgBox("Only Numbers are aloud in this Textbox", vbCritical, "Error Number")
   KeyAscii = 0
  End If
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 93 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.