VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Allow Numbers

by Javed Jabbar (1 Submission)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

Allow only numbers along with one deciaml.

Rate Allow Numbers

'***********************************************************
' This code only allows numbers along with one decimal
' point in text box named txtNumber. Also allow backspace.
'***********************************************************
    
  If KeyAscii > 47 And KeyAscii < 58 Or KeyAscii = 8 Or KeyAscii = 46 Then
    If KeyAscii = 46 Then
      If InStr(txtNumber.Text, ".") Then
        KeyAscii = 0
        Exit Sub
      Else
        txtNumber.Text = txtNumber.Text
      End If
    Else
    End If
    
  Else
    KeyAscii = 0
  End If

Download this snippet    Add to My Saved Code

Allow Numbers Comments

No comments have been posted about Allow Numbers. Why not be the first to post a comment about Allow Numbers.

Post your comment

Subject:
Message:
0/1000 characters