Link to home
Start Free TrialLog in
Avatar of al4629740
al4629740Flag for United States of America

asked on

check for numerical entry

I have a vb6 form.  In one of the fields, I would like the user to enter the number of hours.  ie.  1, 1.5, 2, 2.5, etc...

How can I verify that they are entering a numerical entry with two decimal places max?
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

You can check the text with this function:
Function Validate(strText As String) As Boolean
    If IsNumeric(strText) Then
        If UBound(Split(strText, ".")) = 1 Then
            If Len(Split(strText, ".")(1)) > 2 Then
                Exit Function
            End If
        End If
        Validate = True
    End If
End Function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of al4629740

ASKER

Is there a way to ask a specific Expert when it comes asking questions on experts exchange?
You can always ask in the question, but it is positively discouraged for good reason

The expert might not be around at the time, so the question could go unanswered. Also each question should be self-contained, and not rely on knowledge of the questioner's project that is not apparent in the question.