There is a known issue in Update 2 with ultrasonic sensors, which causes GetRange to never return if the sensor never hears an echo. See
http://forums.usfirst.org/showthread.php?t=10972 or
http://www.chiefdelphi.com/forums/sh...ad.php?t=72452 for other threads on the same topic.
Update 3 fixes this problem, your code should work as desired after you update.