A Dialogue of Comfort against Tribulation, by St. Thomas More, rendered in modern English by Mary Gottschalk, discusses where one can find true comfort when afflicted by tribulation (pain or sorrow). This post will discuss More's first comfort and some related ideas of St. Thomas Aquinas, described by Peter Kreeft in Practical Theology, his book on the Summa Theologica.
More argued that the first comfort in tribulation is the desire and longing to be comforted by God. This desire includes letting God decide how to comfort us: by removing or diminishing the tribulation or by giving us patience and spiritual consolation to endure it. Whichever occurs is good. Aquinas wrote that great pain can distract us and keep us from contemplating the truth, which is a great good, so removing such pain can lead us back to God.
If the tribulation continues and God gives us patience, then we can endure it. Aquinas wrote that some pain is beneficial, for we learn from it: we can become compassionate, courageous, and wise. Moreover, the pain may prevent us from a moral failing or fault. More wrote that God may "send us sorrow and sickness to make us draw toward Him" (and pray to Him) when we forget Him.
The key is to let God decide. Aquinas wrote that we must trust God; although we can't understand the reasons for the tribulation, we can understand that God can produce good out of any evil (including our tribulations). This "well-ordered" attitude, inspired by God, is a great comfort.