"There's always Hikmah behind whatever situation we're facing right now. Allah must want us to improve our characters through that situation. His plans are always to elevate our ranks for the next world.
Taken from 'The Fifth Paradise: The Garden of Beauty and Felicity by Imam Ahmad.' (agreed upon by Bukhari & Muslim and it has been narrated by Abu Huraira)
If a door in this dunya doesn't open for you, say alhamdulillah. Praise Allah, thank Allah, and trust that He will open another door for you that is better than what you wanted, if not in this life than in the next.