Learn to become more "aware" of your body's position. How we hold ourself is often a result of our phsychological state (how we are feeling). If a person slouches they "feel" like a slouch
When you find yourself in a posture you don't like think about how you "feel." Then replace your slouchy feelings with proud, confident feelings.
Also, visualizing a string being pulled straight up attached to the top of your head and keeping in mind that your shoulders should be pulled back are simple techniques to start to improve your posture.