Try putting this in the form:
Protected Overrides Sub OnNotifyMessage(ByVal m As System.Windows.Forms.Messa
End Sub
Put a breakpoint, and see if it is reached.
Bob
Main Topics
Browse All TopicsAt last Microsoft have acknowledged the problem exists (even if it's not considered a bug) and offered a pretty basic C# solution.
http://support.microsoft.c
Does anybody know how to implement this in VB.Net?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
No joy :(
I was using this:
Protected Overrides Sub WndProc(ByRef m As Message)
debug.writeLine(m.msg.tost
End Sub
And trying to find a unique message. Supposedly - I should get a WM_DESTROY message, but I swear I can't find it either on the parent form or if I create a class that inherits the webbrowser and override the WndProc there. So I just tried to find a message that was unique to when the window closes. There are none. I wouldn't dare look for a unique lParam and Wparam aswell!
Just a note to the CleanUp volunteers - please don't close this yet. I haven't forgotten it!
I raised a support request with Microsoft (first time ever!) and the developer there says he has recreated the issue. Hopefully we'll find a fix or a workaround soon that I will post back here.
This issue has been driving me insane. Slowly but surely.
Please do not close this question. The last response from Microsoft was:
This issue is caused by a bug in the Managed webbrowser control. The windowclosing event does not fire for the managed webBrowser control. A bug has been filed on this issue. The developer group for Visual Studio said that they are planning to fix this in post service pack release on which we do not have a release date yet.
We are looking for a workaround in C# (or VB). Are you working in C# or VB.NET?
I think we're close to an answer.
It has been 8 days since my last response - I'm pretty sure that means this topic is not abandoned.
The VB or C# question was posed to me by Microsoft Support, it wasn't intended as a question for you, sorry if it seemed this way.
I would like this question to be kept open because if a workaround is found it will be of great importance, I'm sure, for other developers using the managed WebBrowser component.
Microsoft response:
The windowclosing event does not fire for the managed webBrowser control. I have
filed a bug on this issue. The work around would be to use the axWebBrowser com
component.
I have contacted the dev group on this issue and they told me that they are
planning to fix this in post service pack release on which we do not have a
release date yet.
I will work with the sample they have sent to create a sample in VB.Net, when complete I will post back a solution here. The C# sample works perfectly (obviously with a different component - but still!)
No, never got a workaround or code example from the internet / Microsoft. The key to getting this working is wrapping the IE ActiveX objects yourself, rather than using the managed web browser control. This, however, presents new problems such as the one highlighted here:
http://www.codeproject.com
Unfortunately, this issue was not fixed in .Net 3 alpha and beta builds and I've not tested to see if it works in .Net 3.5
Business Accounts
Answer for Membership
by: doobdavePosted on 2006-05-19 at 04:06:32ID: 16716867
Hi there,
That's really interesting, I remember I was having that 'unexpected behaviour' when developing an app with the WebBrowser, a while ago, and I never got to the bottom of it.
I remeber our client was fuming that we could not resolve the issue.
I like the way M$ just call it a 'problem (PRB)' like it's really no big deal!!
I'm afraid I can't help you in translating that code to VB.NET (it's in C++, by the way, not C#), though I'd be interested to see what it looks like if someone else replies.
Good Luck!
David