VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This allows you to check in real-time if the data in a text box is a valid integer, and will not le

by Made By Scott Dobson, AKA OmEgA-X1 (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 3rd January 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This allows you to check in real-time if the data in a text box is a valid integer, and will not let you type in anything other than an

API Declarations


Dim xCount As Integer

Rate This allows you to check in real-time if the data in a text box is a valid integer, and will not le



xPeriod = 0
If strDefValue = "" Then
xDefValue = 0
Else
For xCount = 1 To Len(strDefValue)
    If Asc(Mid(strDefValue, xCount, 1)) <= 57 And Asc(Mid(strDefValue, xCount, 1)) >= 48 Or Asc(Mid(strDefValue, xCount, 1)) = 46 Then
        If Asc(Mid(strDefValue, xCount, 1)) = 46 Then
        xPeriod = xPeriod + 1
            If xPeriod > 1 Then
            strDefValue = Left(strDefValue, xCount - 1) & Right(strDefValue, Len(strDefValue) - xCount)
            End If
        End If
    Else
    strDefValue = Left(strDefValue, xCount - 1) & Right(strDefValue, Len(strDefValue) - xCount)
    End If
Next xCount
End If
If strDefValue = "" Then
xDefValue = 1
strDefValue.Text = 1
End If
If Len(strDefValue.Text) = 1 Then
    If Asc(Left(strDefValue.Text, 1)) = 46 Then
    strDefValue = 1
    xDefValue = 1
    End If
End If
End Sub

Download this snippet    Add to My Saved Code

This allows you to check in real-time if the data in a text box is a valid integer, and will not le Comments

No comments have been posted about This allows you to check in real-time if the data in a text box is a valid integer, and will not le. Why not be the first to post a comment about This allows you to check in real-time if the data in a text box is a valid integer, and will not le.

Post your comment

Subject:
Message:
0/1000 characters