How in the world can we answer that question without seeing the code? And "code doesn't work" conveys on useful information that we can use to help you. Tell us what the code actually does and how that differs from what you want. If there are compile errors, post the entire error message. Do not paraphrase.
Read the forum guidelines to see how to properly post code and error messages.