tips
There are 1 entries for the tag tips
Wednesday, February 17, 2010 10:31 AM | Comments

I saw the following question asked earlier today -- the only context given was the code itself. Can anyone tell me what’s wrong with this Dim min As Integer = Integer.Parse(leavingTimeTextBox.Text.Substring(leavingTimeTextBox.Text.IndexOf(":") + 1, leavingTimeTextBox.Text.Length) -1 )? it shows me an exception index out of range exception: length and index must be within the range of the string, parameter name: length  so its five characters and on debug time : index is 2 so I'm starting from index 3 to length which is 5 -1 "4" It was clear that he looking to parse some sort of pre-defined time format, but just to be sure I confirmed it with him. While I could have helped this person resolve the question he asked about (the IndexOutOfRangeException), instead I took a step back to focus on what he really wanted to achieve. His immediate  problem was that he was too focused on the...