Advice of the Prophet (Pbuh) to his companion (R.a) :
Be mindful of Allah, and you will find Him in front of you. Recognize and acknowledge Allah in times of ease and prosperity, and He will remember you in times of adversity. And know that what has passed you by [and you have failed to attain] was not going to befall you, and what has befallen you was not going to pass you by. And know that victory comes with patience, relief with affliction, and ease with hardship.
[Narrated by At-Trimidhi. Book-Forty AHadith Imam Nawawi, No.19]