VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Only Numbers in Textbox...and when the user types an other character...it is deleted and waits for

by Cobm@n (1 Submission)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 3rd May 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Only Numbers in Textbox...and when the user types an other character...it is deleted and waits for number at the end of the Textbox text!

Rate Only Numbers in Textbox...and when the user types an other character...it is deleted and waits for



If txtdigits.Text <> "" Then
    dig$ = Mid(txtdigits.Text, Len(txtdigits.Text), 1)
    If Asc(dig$) < 48 Or Asc(dig$) > 59 Then
        MsgBox ("Only numbers in digits..."), vbCritical, "Error"
        For i = 1 To Len(txtdigits.Text) - 1
            digi$ = Mid(txtdigits.Text, i, 1)
            digits$ = digits$ & digi$
        Next i
        txtdigits.Text = digits$
        txtdigits.SelStart = Len(txtdigits.Text)
    End If
End If
End Sub

Download this snippet    Add to My Saved Code

Only Numbers in Textbox...and when the user types an other character...it is deleted and waits for Comments

No comments have been posted about Only Numbers in Textbox...and when the user types an other character...it is deleted and waits for . Why not be the first to post a comment about Only Numbers in Textbox...and when the user types an other character...it is deleted and waits for .

Post your comment

Subject:
Message:
0/1000 characters