EDN Admin
Well-known member
Im trying to change the new window target for my browser so it doesnt open up IE when something opens in a new window.
Heres the code:
<pre class="prettyprint lang-vb" style=" Private Sub Browser_NewWindow(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs)
Dim myElement As HtmlElement = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Document.ActiveElement
Dim target As String = myElement.GetAttribute("href")
Dim Form As New Form1
Form.Show()
Form(CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser)).Navigate(target)
cancel opening IE window
e.Cancel = True
End Sub[/code]
<br/>
The error is at
<pre class="prettyprint lang-vb" style=" Form(CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser)).Navigate(target)[/code]
<br/>
with the word Form. How do I fix it?
<
Nathaniel Washburn N-Soft Developer
<br/>
View the full article
Heres the code:
<pre class="prettyprint lang-vb" style=" Private Sub Browser_NewWindow(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs)
Dim myElement As HtmlElement = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Document.ActiveElement
Dim target As String = myElement.GetAttribute("href")
Dim Form As New Form1
Form.Show()
Form(CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser)).Navigate(target)
cancel opening IE window
e.Cancel = True
End Sub[/code]
<br/>
The error is at
<pre class="prettyprint lang-vb" style=" Form(CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser)).Navigate(target)[/code]
<br/>
with the word Form. How do I fix it?
<
Nathaniel Washburn N-Soft Developer
<br/>
View the full article