donaldc104
Active member
- Joined
- Jan 4, 2003
- Messages
- 32
Good suggestion (thanks!) but no luck.
HashCode is still the only known method to make my program work.
I tested two error cases: 1. Port Not Open and 2. Timeout.
The only way to tell the difference between them is HashCode.
Heres the code I used:
Here are the outputs from the two tests:
TEST1 GT=System.ApplicationException, H=-108330557, M=Please initialize and open port before using this method
TEST1 GT=System.ApplicationException, H=-1549478346, M=Read Error: Timeout error
I tested on two different machines, both Win2000 but different configurations. Identical results.
The HashCode numbers are constant, so this seems reliable.
Maybe this will remain one of those unanswered questions.
HashCode is still the only known method to make my program work.
I tested two error cases: 1. Port Not Open and 2. Timeout.
The only way to tell the difference between them is HashCode.
Heres the code I used:
Code:
Catch exc As Exception
Dim ExceptionType As System.Type
ExceptionType = exc.GetType() Error GetType
strErrMsg = exc.Message.ToString Text Error Message.
iHashCode = exc.Message.GetHashCode Error HashCode
Console.WriteLine("TEST1 GT=" & exc.GetType().ToString() _
& ", H=" & iHashCode & ", M=" & strErrMsg)
TEST1 GT=System.ApplicationException, H=-108330557, M=Please initialize and open port before using this method
TEST1 GT=System.ApplicationException, H=-1549478346, M=Read Error: Timeout error
I tested on two different machines, both Win2000 but different configurations. Identical results.
The HashCode numbers are constant, so this seems reliable.
Maybe this will remain one of those unanswered questions.