Learn to use the debugger to step through your code. You will find out for yourself where the problem lies. If it is not clear how to fix it, then ask a specific question. The more tools you have at your disposal to deal with programming problems, the better you'll be at it.
-- David B. Chorlian Neurodynamics Lab SUNY/HSCB email@example.com firstname.lastname@example.org