tabpage(s) with webbrowser

S

Supra

I have a tab control in a which a few of the tabs include an AxWebBrowser browser control. Let say i have currently tabpage2 and i typed url in combobox when i pressed enter it doesn't display webbrowser instead i can do create new tab. ne one knows how to display currrently displayed regardless of tabpage(s)?
here is code:
Public Sub AddBrowserTab()
AxWebBrowser1.Visible = False
Dim newPage As TabPage = New TabPage(Text) ' Delcare and create the tab page
Dim browser As AxSHDocVw.AxWebBrowser = New AxSHDocVw.AxWebBrowser ' Declare and create the browser(control)
newPage = New TabPage(Text)
browser = New AxSHDocVw.AxWebBrowser
newPage.Controls.Add(browser) ' Add the browser to the tab(page)
browser.Dock = DockStyle.Fill ' Fill the tab page withit.
browser.Enabled = True ' Enable it

TabControl1.TabPages.Add(newPage) ' Add the tab page to the tab control
TabControl1.Visible = True

browser.Navigate2(cboAddress.Text)
browser.Silent = False
newPage.ToolTipText = Text

Debug.WriteLine("NP :" & newPage.TabIndex)
Debug.WriteLine("Name :" & newPage.Text.ToString())
' browser.Navigate2("about:blank") ' Set initial page to blank()
cboAddress.Text = String.Empty
End Sub
 
C

Cor Ligthert

Supra,

I made a form with a tabcontrol with two tabpages on it.
Dragged to both a button
Dragged to both a axwebbrowser

It works exactly as I expected.

Until now I never saw somebody in this newsgroups who succeeded to use the
axwebbrowser without draging it on a form (not that I say that it is
impossible however it will be probably a lot of work and dragging does all
the settings in the RESX)

I hope this helps?

Cor
 
C

Cor Ligthert

Supra,

That needs almost no code.
When the axwebbrowser is not in your toolbox

Open the toolbox rightclick on, choose Com and check the checkbox Microsoft Webbrowser

Create a new form and drag to that a tabcontrol
Create in that 2 tabpages
Drag on every tabpage a button
Drag on every tabpage an axwebbrowser from your toolbox
Click on the two buttons to create events from both
Set in those
Me.AxWebBrowser1.Navigate2("www.google.com")
And
Me.AxWebBrowser1.Navigate2("msdn.microsoft.com")

Sample ready

I hope this helps?

Cor
"Supra" <[email protected]>

do u have code to send me so i can take a look at it and see how it works?


Cor Ligthert wrote:

Supra,

I made a form with a tabcontrol with two tabpages on it.
Dragged to both a button
Dragged to both a axwebbrowser

It works exactly as I expected.

Until now I never saw somebody in this newsgroups who succeeded to use the
axwebbrowser without draging it on a form (not that I say that it is
impossible however it will be probably a lot of work and dragging does all
the settings in the RESX)

I hope this helps?

Cor


"Supra" <[email protected]>

I have a tab control in a which a few of the tabs include an AxWebBrowser
browser control. Let say i have currently tabpage2 and i typed url in
combobox when i pressed enter it doesn't display webbrowser instead i can
do create new tab. ne one knows how to display currrently displayed
regardless of tabpage(s)?
here is code:
Public Sub AddBrowserTab()
AxWebBrowser1.Visible = False
Dim newPage As TabPage = New TabPage(Text) ' Delcare and create
the tab page
Dim browser As AxSHDocVw.AxWebBrowser = New AxSHDocVw.AxWebBrowser
' Declare and create the browser(control)
newPage = New TabPage(Text)
browser = New AxSHDocVw.AxWebBrowser
newPage.Controls.Add(browser) ' Add the browser to the
tab(page)
browser.Dock = DockStyle.Fill ' Fill the tab page
withit.
browser.Enabled = True ' Enable it

TabControl1.TabPages.Add(newPage) ' Add the tab page to the
tab control
TabControl1.Visible = True

browser.Navigate2(cboAddress.Text)
browser.Silent = False
newPage.ToolTipText = Text
Debug.WriteLine("NP :" & newPage.TabIndex)
Debug.WriteLine("Name :" & newPage.Text.ToString())
' browser.Navigate2("about:blank") ' Set initial page to
blank()
cboAddress.Text = String.Empty
End Sub
 
S

Supra

thank!

Cor said:
Supra,

That needs almost no code.
When the axwebbrowser is not in your toolbox

Open the toolbox rightclick on, choose Com and check the checkbox
Microsoft Webbrowser

Create a new form and drag to that a tabcontrol
Create in that 2 tabpages
Drag on every tabpage a button
Drag on every tabpage an axwebbrowser from your toolbox
Click on the two buttons to create events from both
Set in those
Me.AxWebBrowser1.Navigate2("www.google.com <http://www.google.com>")
And
Me.AxWebBrowser1.Navigate2("msdn.microsoft.com <http://www.google.com>")

Sample ready

I hope this helps?

Cor

"Supra" <[email protected] <mailto:[email protected]>>

do u have code to send me so i can take a look at it and see how
it works?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top