Article ID: 311282 - Last Review: May 13, 2007 - Revision: 4.1 How to use the WebBrowser control NewWindow2 event in Visual Basic .NETThis article was previously published under Q311282 On This PageSUMMARY This article describes how to use the NewWindow2 event.
The NewWindow2 event is triggered by the WebBrowser control that is included with
Microsoft Internet Explorer 4.0 and later versions. You can use this event to specify
that your browser program will always be used when a new browser
window is opened. This article describes this procedure by using Visual Basic
.NET. The NewWindow2 eventThe NewWindow2 event occurs when a new window is to be created for displaying a resource. This event occurs before a new window is created from the WebBrowser control. For example, this event occurs in response to a navigation that is targeted to a new window or to a scripted window.open method.To specify that your browser program is to be used when a new window is opened, set the ppDisp parameter equal to a new WebBrowser object that is contained in a new window that your program creates. In this scenario, if a user chooses to open a Web page in a new window, the new window in your program is used to display the new Web page. Additionally, set the RegisterAsBrowser property to TRUE. This setting causes the new WebBrowser control to participate in window-name resolution. For example, if the window name is used elsewhere in the script, this control is used instead of a newly created one because the control examines all the existing window names before opening a new window. Create the project and then add codeThe following sample navigates the WebBrowser control to http://www.microsoft.com (http://www.microsoft.com) .
Verification
REFERENCES For more information about the WebBrowser control and the
methods, the properties, and the events that it exposes, view the WebBrowser
documentation at the following Microsoft Developer Network (MSDN) Web site: http://msdn2.microsoft.com/en-us/library/Aa752043.aspx
(http://msdn2.microsoft.com/en-us/library/Aa752043.aspx)
| Article Translations
|
Back to the top
