The idiom every cloud has a silver lining means to be optimistic, even difficult times will lead to better days. It also means every bad situation has some good aspect to it. This proverb is usually said as an encouragement to a person who is overcome by some difficulty and is unable to see any positive way forward. The origin of the phrase is most likely traced to John Milton's "Comus" in 1634.
Example 1: I'm sorry your business is going badly, but don't despair. Every cloud has a silver lining.
Example 2: When Mary's friends visited her in the hospital, they tried to cheer her up, but Mary never could find the silver lining in the cloud of her illness.
Example 3: As the trip's been cancelled, I'll be able to go to the match this Saturday. Every cloud has a silver lining.
Example 4: Don't worry. It will be all right. Every cloud has a silver lining.