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