Is there an efficient method in VB to check if a string can be converted to a double?
I'm currently doing this by trying to convert the string to a double and then seeing if it throws an exception. But this seems to be slowing down my application.
Try
' if number then format it.
current = CDbl(x)
current = Math.Round(current, d)
Return current
Catch ex As System.InvalidCastException
' item is not a number, do not format... leave as a string
Return x
End Try