Your program works fine for me.
Are you sure it's not just Visual Studio informing you that an exception was thrown. If you run the application outside of Visual Studio does it work as expected?
You can change the behaviour of Visual Studio's exception handling from the Debug/Exceptions... menu.