There is no movement in GetStockSize, so shouldn't be any other error checking than if there is a problem getting the values from the screen.
Fixed
Agree. It's getting a bit unwieldy, but as you've probably understood already (or I have said it earlier), I'm not a programmer...
I have made an attempt at reducing the size. Both the actual probing and moving have now been moved into a single function for each instead of a function for each direction. This makes it a bit more difficult to understand and troubleshoot, though. Another option to reduce the size more, is to split the file into two different files, one for external probing and one for internal probing. Or move everything from the switch/case into each calling program, keep the definitions, MoveDirection and Probe functions still in the main file..
Br,
Stig