I'm receiving the following error:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: Length cannot be less than zero.
'Parse coordinate string into coordinate values (degrees, minutes, seconds)
StartPtr = 0
StopPtr = DegreeString.IndexOf("°", StartPtr)
Degrees = Convert.ToDouble(DegreeString.Substring(StartPtr, StopPtr - StartPtr))
Substring(startIndex, length) function is complaining that you passed a negative number as the
length parameter. Which is invalid for obvious reasons (right?).
This means that
StopPtr - StartPtr must be evaluating to something less than zero. You know
StartPtr is exactly zero, because you just set it to zero. So
StopPtr must be less than zero.
So that means
DegreeString.IndexOf("°", StartPtr) is returning a negative number.
IndexOf function returns -1 when the substring is not found.
So the problem must be that
DegreeString does not contain the character