The author - may Allah shower blessings on him - mentioned these hadeeths in his book, Riyaadus Saaliheen. They are as regards what the bereaved should say near the dead.
We have previously discussed the first two hadeeths of this chapter, both were narrated by Umm Salamah - may Allah be pleased with him. When her husband died, she said: 'Truly! We belong to Allah and to Him we shall return. O Allah compensate me in my affliction, recompense my loss and give me something better in exchange for it.' Thereafter, Allah bestowed upon her Muhammad ؓ.
The other three hadeeths are related the one who loses a child. He praised Allah and said: 'Inna lillahi wa inna ilaihi rajiun (Truly! We belong to Allah and to Him we shall return)' and remained patient. For such a person, Allah, Glorious and Exalted, will reward him with Paradise as stated in the hadeeth: 'When the angels take the soul of the child of a servant of Allah, Allah asks the angels: 'You have taken the soul of the child of My servant? They reply: 'Yes.' Though Allah,
Honored and Glorious, knows this but He asks in order to manifest the importance of this servant of His. So, he praised Allah and said: 'Truly! We belong to Allah to Him we shall return' when this great calamity befell him. So, Allah queries: 'You have taken away the flower of his heart?' They reply: 'Yes.' Allah asks: 'So, what did he say?' They reply: 'He praised You and said truly! We belong to Allah and to Him we shall return.'
Praising Allah when a calamity befalls one points to the patience of a person upon the ordainments of Allah and that he is patient. So, he praised Allah due to his patience upon this calamity. Whenever something displeasing befell the Prophet ﷺ, he would say: 'Al-Hamdu lillahi 'alaa kulli haalin – Praise be to Allah in all situations,'(1) and when he experiences that which pleases him, he would say: 'Alhamdu lillahi aladhi bi nimatihi tatimmu as-salihah – Praise be to Allah, the One by Whose leave good things are accomplished.'(2)
When that which pleases you happens to you then say: 'Praise be to Allah, the One by Whose Blessings good things are accomplished,' and when the opposite happens say: 'Praise be to Allah in all situations.'
Also, Allah the Glorious and Exalted, informs in the hadeeth narrated from Him by the Prophet ﷺ: 'When He (Allah) takes the soul of the child of His servant and he is patient thereupon, expecting reward, Allah recompenses him with Paradise.'
Also, in the hadeeth reported by Al-Bukhari, the Prophet ﷺ said: 'Allah the most High said: My servant shall get no other reward when I take (the soul) of his beloved one and he is patient thereupon hoping for reward, except Paradise.'
The last hadeeth is a story about one of the daughters of the Prophet ﷺ who had a child experiencing the throes of death. She sent someone to the Prophet ﷺ, and he ﷺ told the person: 'Tell her that to Allah belongs what He takes and what he bestows, everything with Him has an appointed time. So, order her to be patient and to hope
for reward.' While commiserating a person for a loss, one should console his brother with these words for they are the best form of condolence. 'To Allah belongs that which he takes and that which he bestows everything with him has an appointed time, be patient and hope for reward.'
Allah alone grants success.