In one of my program's validation, I need to check if a resulting number stored in a session is undefined (this is due to one of the formula may have a dividend of zero).
What I tried so far (and it may be a very inefficient way of doing it) is this:
Dim x As Double
Dim valid As Boolean = True
Try
Double.TryParse(Session("result"), x)
Catch ex As Exception
valid = False
End Try
I figured that if the number stored in the session is indefinite or undefined, the TryParse function will fail. What do you think is the better way to catch undefined numbers stored in object?
P.S. Unfortunately, I cannot validate the function where the Session("result") will originate. This is because another module created by another coder is just passing that to the module I'm coding.