Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27196

VS 2010 Page title in tab instead of URL. & Tab title issue.

$
0
0
Hello,

I am having 2 small issues and need a bit of help

Firstly, I have set up a tabbed browser, which works great. I am also using MS Web Browser instead of the normal Web Browser for specific reasons.

ISSUE 1:
Now the problem I am having is in the Tabs on startup it will show the page title (Example:) homepage is set for Facebook.com, so when the browser loads, it will show "Facebook" in the tab, open a few more tabs, also says "Facebook". If I click on a link and goto a different page, it then shows the whole URL in tab instead of the page title. So If I goto google.com, it will show Google in the tab, if I search for something.. lets say "funny images", It then shows the entire URL in the tab, which then with google search the URL is really long, and shows that in the tab.

Name:  issue1.png
Views: 39
Size:  33.3 KB

"code" I am using for that is:

Code:

Form1.TabControl1.SelectedTab.Text = AxWebBrowser1.LocationName.ToString
Anywhere I use AxWebBrowser1.LocationName.ToString (and even with out .ToString) its showing the whole URL instead of the page title.

How can I either 1. Get the page title only instead of the URL or 2. At least shorten it so its not going half way across the browser?

ISSUE 2:

If I have 1 tab open, and open another tab..

Tab one says : Google, open tab 2, (which loads homepage) both tabs 1 and 2 now say Facebook.


Whole code for ISSUE 1:
Code:

    Private Sub AxWebBrowser1_NavigateComplete2(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event) Handles AxWebBrowser1.NavigateComplete2

        Parent.Text = AxWebBrowser1.LocationName.ToString
        Form1.Text = AxWebBrowser1.LocationName.ToString + (" - ") + Application.ProductName
        TextBox1.Text = AxWebBrowser1.LocationURL
        Form1.TabControl1.SelectedTab.Text = AxWebBrowser1.LocationName.ToString
        If Not My.Settings.history.Contains(AxWebBrowser1.LocationURL.ToString) Then
            My.Settings.history.Add(AxWebBrowser1.LocationURL.ToString)
        End If

    End Sub

Whole code for ISSUE 2
(new tab)

Code:

    Private Sub NewTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewTabToolStripMenuItem.Click
        Dim t As New TabPage
        Dim newtab As New tab
        newtab.Show()
        newtab.TopLevel = False
        newtab.Dock = DockStyle.Fill
        t.Controls.Add(newtab)
        Form1.TabControl1.TabPages.Add(t)
    End Sub

For Issue 2, am I missing something in there?
Attached Images
 

Viewing all articles
Browse latest Browse all 27196

Trending Articles