Re: visual basic input validation integer
"code_wrong " <tac@tac.co.u k> wrote in message
news:4404ac4c$1 _3@mk-nntp-2.news.uk.tisca li.com...[color=blue]
> Visual Basic (not dot net)
> what is the best way to check the User has entered an integer into an
> InputBox?
>
> isNumeric() checks for a numeric value .. but does not notify of numbers
> with decimal places
> inputBox returns a string so I could check for decimal point??? this seems
> like overkill
>
> The value returned can be asigned into an Integer type and then a Single
> type ... the two can be compared .. but still this does not complain about
> numbers with decimal places if the fractional part is zero
>
> what is the simple solution?[/color]
Interesting discussion , thanks for the replies.
I have decided to provide students with a pre-defined function of my own
design
please review and improve if you can
the function:
Function isInteger(strVa l As String) As Boolean
'if not numeric or decimal point found
If Not IsNumeric(strVa l) Or InStr(strVal, ".") Then
isInteger = False
Else
isInteger = True
End If
End Function
"code_wrong " <tac@tac.co.u k> wrote in message
news:4404ac4c$1 _3@mk-nntp-2.news.uk.tisca li.com...[color=blue]
> Visual Basic (not dot net)
> what is the best way to check the User has entered an integer into an
> InputBox?
>
> isNumeric() checks for a numeric value .. but does not notify of numbers
> with decimal places
> inputBox returns a string so I could check for decimal point??? this seems
> like overkill
>
> The value returned can be asigned into an Integer type and then a Single
> type ... the two can be compared .. but still this does not complain about
> numbers with decimal places if the fractional part is zero
>
> what is the simple solution?[/color]
Interesting discussion , thanks for the replies.
I have decided to provide students with a pre-defined function of my own
design
please review and improve if you can
the function:
Function isInteger(strVa l As String) As Boolean
'if not numeric or decimal point found
If Not IsNumeric(strVa l) Or InStr(strVal, ".") Then
isInteger = False
Else
isInteger = True
End If
End Function
Comment