Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stop Non-numeric strings from crashing the server.
#2
You need to do it like this:

Code:
Public Function CCInt(ByVal str As String) As Integer
        If IsNumeric(str) Then
            CCInt = CInt(str)
        Else
            CCInt = Val(str)
        End If
    End Function

    Public Function CCLng(ByVal str As String) As Integer
        If IsNumeric(str) Then
            CCLng = CLng(str)
        Else
            CCLng = Val(str)
        End If
    End Function
    Public Function CCByte(ByVal str As String) As Integer
        If IsNumeric(str) Then
            CCByte = CCyte(str)
        Else
            CCByte = Val(str)
        End If
    End Function
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)