Using End is a very bad idea - if you read the help for it, you will see that it basically says "Don't use this, what it does is intentionally crash your program!"

As you are using subclassing, crashing your program is so bad that it also causes VB to crash, and that is entirely expected.


There are a couple of articles about this in our Classic VB FAQs (in the FAQ forum, which is shown near the top of our home page).

First off, there is Why is using the 'End' statement (or VB's "stop" button) a bad idea?

Then for an explanation (and example code) for how you should be closing a form/program, see the article How should I close my form/program/class?