I'm sorry I must be missing something. if that code is at the top of the event how does the code code below it run. There is code in the valid. I do not wish it to run when "cancel" or "close" is clicked. I hope that makes it clearer.
Extreme Programming = Plan -> Design -> Code -> Test