|
|
Joined: Dec 1999
Posts: 30,867
Master Elite Member
|
Public Function isValidLong(TestValue As String) As Boolean
'Purpose
' Used to determine if a specified string is a valid long integer.
'Parameters
' TestValue (String) = The string we're testing.
'Return (Boolean)
' Returns True if the specified value can be converted to a long integer.
' Returns False if the specified value can not be converted to a long integer.
'Version History
' 1.0 4/29/2006 4:01am Tested by Russ Tanner on VB6 Win2000
'---
'Initiate variables
Dim X As Long 'buffer
'Arm the error handler
On Error Resume Next
Err.Clear
'Test the value
X = CLng(TestValue)
'Return True if an error occured, False otherwise
isValidLong = IIf(Err.Number = 0, True, False)
'Disarm the error handler
On Error GoTo 0
End Function
|
|
|
|
|