Ibn Taymiyah said: 'A calamity that makes you turn to Allah is better for you than a blessing which makes you forget the remembrance of Allah.'
Thus in our times of trouble, when we go through pain and suffering and in our times of loss, we need to trust Allah Azzawajjal. We need to keep in mind that as long as we fear Him and try our best to obey Him, He will never do us wrong. He will protect us and guide us and do the best for us, no matter what the situation apparently looks like.
Allaah Azzawajjal says in a hadeeth Qudsi:
'I am as my slave thinks of me and I am with him whenever he remembers me.' (Agreed Upon).