Where is your CalculateX and CalculateY methods? I think somewhere in there you are trying to use an object that hasn¡¯t been instantiated.?
If you comment out those 2 method calls and run the code again do you still get the exception ?