1. You should use <pre> or <code> tag to format code properly. 2. You should debug your application and try find the problem yourself. You just wrote some code, it doesn't work, so you think someone on the internet will fix it for you? 3. Connected to number 2 - you should tell us more specifically, what the problem is. "application hang" in the subject isn't telling us to much. You think we will run your code and check, where does it hang? We won't. Firstly you only gave us part of the code ("code-behind" of your form), and we don't know what controls you have on this form. Secondly, it's your job to locate the problem, and then we can tell you how to fix it. And if you can't locate the problem, than you should find at least a piece of code, that's causing it. Most of us here are willing to help, but you should show us, that you've done something to solve the problem yourself.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.