I don't know how the TimeSpan class works, but just glancing at that code I notice your for loops are a bit screwy. You want to use "==" for comparison not "=". You are basically never entering the loop because you first set the StepDuration to 100, then set it to 0 (which is true) so it exits...