views:

2823

answers:

4

When you use the WebBrowser control in .NET you can "embed" an instance of IE in your application, essentially making your own IE-based Web Browser.

Does anyone know how to make any new windows created (like when the user selects "Open in New Window" from the context menu) open up in another Window of Your Web Browser Application, instead of the computers default browser??

+4  A: 

Maybe the Source Code from this CodeProject article can help:

Extended .NET 2.0 WebBrowser Control

mjnagpal
+1  A: 

I did this a long time ago in VB.

From what I remember, when a NewWindow2 event was fired by the control, we would cancel the original request and open a separate VB form that contained another instance of the WebBrowser control pointed at the requested URL.

I did a quick google search and it seems like maybe this event isn't as easy to access in .Net. Take a look here for a possible solution.

JKueck
A: 

There's a code sample here that contains code for adding the NewWindow2 event to the WebBrowser control. It sure would be nice if they added this event to the WebBrowser control itself.

http://zerosandtheone.com/media/p/277.aspx

Chris Pietschmann
Darn! I was hoping I actually answered my first question :)
JKueck
A: 

This site has the best solution I've found if you're using the .net version of the webbrowser control

http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/f497f8a5-dac8-48cb-9fce-7936c9389f09

John Sims