“Jesus answered, “It was neither that this man sinned, nor his parents; but it was so that the works of God might be displayed in him.”
‭‭John‬ ‭9:3‬ ‭NASB‬‬
This is the reason for everything that is happening in our lives — “so that the works of God might be displayed” in us, too. 
When we see the man’s blindness in John 9 as a picture, as a specific instance of affliction or difficulty or infirmity more generally, then we can take heart in the midst of just about anything. This is a part of my life so that the works of God might be displayed in me!
It’s so easy to accuse ourselves, just as the disciples did the blind man — “is this happening because I have sinned?” Certainly, we do suffer consequences for our sin, and so that’s not a bad question to ask. But as we see here, there are some afflictions that are NOT the result of sin. Some, as we read of Paul in 2 Corinthians 12, are even given in order to prevent sin. 
But regardless, what shall we say of affliction? “It is so that the works of God might be displayed in me.” That is why we can "exult in tribulation," as it says in Romans 5:3. 
We can apply this single phrase to the various afflictions we all face, and take heart! That unfair boss? That naughty child? That long commute? That difficult coworker? That impossible in-law? That perplexing decision? And on and on... “this affliction has been allowed so that the works of God might be displayed in and through my life!” 
God is less interested in changing my boss than He is in changing me! He’s less interested in removing mean people from my life than He is is displaying His kindness in and through me! He’s less interested in giving me an easy commute than He is in perfecting endurance in me! He is less interested in giving me superficial, circumstantial peace at home than He is in giving me an opportunity to partake of the gentleness and humility of Jesus Christ. We need to see our affliction as a calling, as an invitation, and as an opportunity to enter more fully into partaking of the life of Christ as we hold fast to His Word and seek His glory. 
How should we respond to our afflictions, in light of Jesus’ teaching in John 9? If it’s not already apparent from the above, then we have Jesus as our Forerunner, so we can look at Him and see how He responded to affliction:
Now My soul has become troubled; and what shall I say, ‘Father, save Me from this hour’? But for this purpose I came to this hour. Father, glorify Your name.”
‭‭John‬ ‭12:27-28‬ ‭NASB‬‬
What Jesus was passionate about is that God would accomplish the purpose for which He allowed affliction into His life. Not that His Father would remove the affliction, but that God would glorify His Own name through it. This is the prayer of One who believes affliction is allowed “so that the works of God might be displayed in Me.”
What a word I need for my own afflictions, today! It’s so easy to seek the removal of the circumstance rather than the fulfillment of God’s purpose. This is one area where I desperately need to seek renewal of my mind regularly (Romans 12:2), because the course of this world and my flesh do not share the nature of Jesus in regards to affliction. Everything in me, and everything outside of me, shouts, “Save me from this hour!” I have to seek the Lord to give me a passion for the name and glory of my Father in heaven that far outweighs my desire for affliction to pass. I need a higher love than a love of myself. 
He will do it, if we keep asking, keep seeking, and keep knocking (Luke 11:9). 
And the Holy Spirit also testifies to us, saying, “THIS IS THE COVENANT THAT I WILL MAKE WITH THEM AFTER THOSE DAYS, SAYS THE LORD: I WILL PUT MY LAWS — the life of Christ Jesus, which is the law of the Spirit — UPON THEIR HEART, AND ON THEIR MIND I WILL WRITE THEM.”
‭‭Hebrews‬ ‭10:15-16‬ ‭‬‬+ Romans 8:2
I take this to mean that I can hold God to His word to give me the same passion for His glory that He gave Jesus.
May it be so, according to the riches of His grace in Christ.