My speedometer will stop working at times.. but when I switch on the cruise control, it will start working again.. but will stop even when the cruise switch is on.

Does anybody have any idea what that might be causing it?

please help
thank you
Brian B