You need to use debug and step through your code, line-by-line. It isn't complicated and should give you a good idea of where you are going wrong. After a cursory look at the code, I can't see any...