Sadness and depression are chemical events in your brain that you have no conscious control over
You can consciously control some of the common triggers that lead to negative thoughts but most people can't completely turn off given thoughts
Your brain is like the earth and thoughts are like rivers, the more you think certain ways the more you will continue to think those ways, neural pathways are strengthened by their activations
Learn to redirect, wear a bracelet or similar physical reminder of a specific thing you like, when you experience the thoughts you want to avoid, redirect and focus on the things you like
Change your environment, identify triggers that push you toward depression and avoid them. Some literally cannot be avoided, and some situations are impossible to escape, in those cases accept the associated negativity and redirect
Find people who have the attitudes and feelings you want to emulate and spend time with them, we are social and learn much from our peers
Ingest media that aligns with your desired world view, avoid tragedies, horror movies, gore, popular doom news media, etc. This will force you into an echo chamber but it is a popular coping technique
Most important you are your own person, write down how you feel and what triggered those emotions every day. You can't really know if you're improving if you don't have a record