locked
Adding Favourites to Web Browser RRS feed

  • Question

  • Hey,

    I am trying to add a favourites option to my web browser, but I am unsure how to add them.

    I'm just looking for a simple option which will display the favourites on a single button click, and then be able to add the current page to the favourites menu.

    Thanks,
    Jack
    Wednesday, September 3, 2008 4:48 PM

Answers

  • jackdelamare said:
    I am trying to add a favourites option to my web browser, but I am unsure how to add them.

    I'm just looking for a simple option which will display the favourites on a single button click, and then be able to
    add the current page to the favourites menu.

    Hi Jack,

    Welcome to MSDN forums!

    To implement Favorites feature for your web browser, you can use My.Settings to store favorites links in VB.NET.

    Firstly create a New Settings variable:
    Project -> Properties -> Settings ->create a setting as below

    Name   favList                           
    Type  
    System.Collections.Specialized.StringCollection   (Browser and locate this type)
    Scope    User         
    Value   (Add at least one item)

    Then please try the following code sample which can work as you expect.

    Prerequisites: Drag&drop MenuStrip1 (with ToolStripMenuItem1 and ToolStripMenuItem2) and WebBrowser1 onto Form1.

    Public Class Form1  
     
        Private Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load  
            ToolStripMenuItem1.Text = "Favorites" 
            ToolStripMenuItem2.Text = "Add" 
            WebBrowser1.Navigate("http://www.microsoft.com")  
     
            ' Load Settings to Favorites menu when opening form  
            For Each item As String In My.Settings.favList  
                Dim item1 As New ToolStripMenuItem  
                item1.Text = item.ToString  
                ToolStripMenuItem1.DropDownItems.Add(item1)  
            Next 
     
            'Add Click Event handler for each Favorite link ToolStripMenuItem  
            For Each C As ToolStripMenuItem In ToolStripMenuItem1.DropDownItems  
                AddHandler C.Click, AddressOf ToolStripMenuItem_Click  
            Next 
     
        End Sub 
     
        'Add item to Favorites menu and FavList Settings  
        Private Sub ToolStripMenuItem2_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click  
            Dim item1 As New ToolStripMenuItem  
            item1.Text = WebBrowser1.Url.ToString  
            ToolStripMenuItem1.DropDownItems.Add(item1)  
     
            My.Settings.favList.Add(WebBrowser1.Url.ToString)  
        End Sub 
     
        'Open faverite link when selecting link item from Faverite menu  
        Private Sub ToolStripMenuItem_Click(ByVal sender As ObjectByVal e As System.EventArgs)  
            WebBrowser1.Navigate(sender.ToString)  
        End Sub 
     
        'Save Settings when closing form  
        Private Sub Form1_FormClosed(ByVal sender As System.ObjectByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed  
            My.Settings.Save()  
        End Sub 
     
    End Class 

    Illustration:



    In addition, if you feel interested in "How to create own Web Browser", please check the following thread:
    http://social.msdn.microsoft.com/forums/en-US/Vsexpressvb/thread/8ea89e24-c60b-4ce5-a0de-39217f15b1b8/

    Glad to help you.
    If I misunderstood you, please let me know. :)


    Best regards,
    Martin Xie

    Tuesday, September 9, 2008 6:37 AM

  • jackdelamare said:

    What would I write in for the value?

    How to assign value for the favList Settings variable of StringCollection type?
    Project menu -> Properties -> Settings tab-> Click "..." button and then enter String items as the following illustration demonstrated.


    Leave your email, I will send my sample project to you for checking.

    Regards,
    Martin
    v-maxie@microsoft.com
    • Marked as answer by jackdelamare Thursday, September 11, 2008 5:19 PM
    Thursday, September 11, 2008 2:38 AM
  • jackdelamare said:

    The solution worked ok but I had to add it again as there were many errors, so I added a whole new menustrip. Anyhow, I have added it and the favourites bar works, but the add button does not. Here is the code I currently have, as you can see it's exactly what you wrote above, so I'm unsure why add isn't working.

     
        'Add item to Favorites menu and FavList Settings 
        Private Sub ToolStripMenuItem18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
    (-> Please try changing to ToolStripMenuItem18)
            Dim item1 As New ToolStripMenuItem
            item1.Text = WebBrowser1.Url.ToString
            ToolStripMenuItem4.DropDownItems.Add(item1)

            My.Settings.favList.Add(WebBrowser1.Url.ToString)
        End Sub


    I apply your code to my sample project and it works fine. Please double check.
    • Marked as answer by jackdelamare Tuesday, October 14, 2008 8:06 PM
    Tuesday, October 14, 2008 1:05 PM

All replies

  • jackdelamare said:
    I am trying to add a favourites option to my web browser, but I am unsure how to add them.

    I'm just looking for a simple option which will display the favourites on a single button click, and then be able to
    add the current page to the favourites menu.

    Hi Jack,

    Welcome to MSDN forums!

    To implement Favorites feature for your web browser, you can use My.Settings to store favorites links in VB.NET.

    Firstly create a New Settings variable:
    Project -> Properties -> Settings ->create a setting as below

    Name   favList                           
    Type  
    System.Collections.Specialized.StringCollection   (Browser and locate this type)
    Scope    User         
    Value   (Add at least one item)

    Then please try the following code sample which can work as you expect.

    Prerequisites: Drag&drop MenuStrip1 (with ToolStripMenuItem1 and ToolStripMenuItem2) and WebBrowser1 onto Form1.

    Public Class Form1  
     
        Private Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load  
            ToolStripMenuItem1.Text = "Favorites" 
            ToolStripMenuItem2.Text = "Add" 
            WebBrowser1.Navigate("http://www.microsoft.com")  
     
            ' Load Settings to Favorites menu when opening form  
            For Each item As String In My.Settings.favList  
                Dim item1 As New ToolStripMenuItem  
                item1.Text = item.ToString  
                ToolStripMenuItem1.DropDownItems.Add(item1)  
            Next 
     
            'Add Click Event handler for each Favorite link ToolStripMenuItem  
            For Each C As ToolStripMenuItem In ToolStripMenuItem1.DropDownItems  
                AddHandler C.Click, AddressOf ToolStripMenuItem_Click  
            Next 
     
        End Sub 
     
        'Add item to Favorites menu and FavList Settings  
        Private Sub ToolStripMenuItem2_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click  
            Dim item1 As New ToolStripMenuItem  
            item1.Text = WebBrowser1.Url.ToString  
            ToolStripMenuItem1.DropDownItems.Add(item1)  
     
            My.Settings.favList.Add(WebBrowser1.Url.ToString)  
        End Sub 
     
        'Open faverite link when selecting link item from Faverite menu  
        Private Sub ToolStripMenuItem_Click(ByVal sender As ObjectByVal e As System.EventArgs)  
            WebBrowser1.Navigate(sender.ToString)  
        End Sub 
     
        'Save Settings when closing form  
        Private Sub Form1_FormClosed(ByVal sender As System.ObjectByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed  
            My.Settings.Save()  
        End Sub 
     
    End Class 

    Illustration:



    In addition, if you feel interested in "How to create own Web Browser", please check the following thread:
    http://social.msdn.microsoft.com/forums/en-US/Vsexpressvb/thread/8ea89e24-c60b-4ce5-a0de-39217f15b1b8/

    Glad to help you.
    If I misunderstood you, please let me know. :)


    Best regards,
    Martin Xie

    Tuesday, September 9, 2008 6:37 AM
  • From that code, I get this one error:



    Any ideas how to fix this?
    Tuesday, September 9, 2008 4:02 PM
  • Martin Xie - MSFT said:

    Firstly create a New Settings variable:
    Project -> Properties -> Settings ->create a setting as below

    Name   favList                           
    Type  
    System.Collections.Specialized.StringCollection   (Browser and locate this type)
    Scope    User         
    Value   (Add at least one item)


    Hi Jack,

    Sorry, the favList Settings value is required not optional. You need to add at least one item beforehand. Please take it a try.

    Wednesday, September 10, 2008 5:12 AM
  • What would I write in for the value?
    Wednesday, September 10, 2008 3:02 PM

  • jackdelamare said:

    What would I write in for the value?

    How to assign value for the favList Settings variable of StringCollection type?
    Project menu -> Properties -> Settings tab-> Click "..." button and then enter String items as the following illustration demonstrated.


    Leave your email, I will send my sample project to you for checking.

    Regards,
    Martin
    v-maxie@microsoft.com
    • Marked as answer by jackdelamare Thursday, September 11, 2008 5:19 PM
    Thursday, September 11, 2008 2:38 AM
  • Thank you Martin! It worked perfectly. My e-mail is jack@delamarepro.com  - I'd still like to see your project too :).

    I guess now, I can work with the code to have a dialog window of some kind to make it more attractive.
    Thursday, September 11, 2008 5:19 PM
  • Hi Jack,

     

    Glad to hear that you got it working. Cheers!

     

    My sample project about web browser Favorites feature, has been sent to your mailbox. Please check it.

     

     

    Best regards,
    Martin Xie

    Friday, September 12, 2008 3:34 AM
  • Martin,

    I have finally got around to adding this to my Teega Web Browser, but unfortunately there has been some issues. Took me a while to add it regardless, but when I run Teega I get this error:


    Any ideas?
    Sunday, October 12, 2008 5:19 PM
  • Hi Jack,

    The solution is here:

            'Add Click Event handler for each Favorite link ToolStripMenuItem  
            For Each As ToolStripItem In ToolStripMenuItem1.DropDownItems  
                If TypeOf (C) Is ToolStripMenuItem Then 'Exclude ToolStripSeparator items
                    AddHandler C.Click, AddressOf ToolStripMenuItem_Click  
                End If 
            Next 
    Monday, October 13, 2008 3:32 AM
  • Hi Martin,

    The solution worked ok but I had to add it again as there were many errors, so I added a whole new menustrip. Anyhow, I have added it and the favourites bar works, but the add button does not. Here is the code I currently have, as you can see it's exactly what you wrote above, so I'm unsure why add isn't working.

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.WebBrowser1.AllowNavigation = True
            Me.WebBrowser1.AllowWebBrowserDrop = True
            WebBrowser1.Navigate("http://www.delamarepro.com/teega")

            ToolStripMenuItem4.Text = "Favorites"
            ToolStripMenuItem18.Text = "Add"

            ' Load Settings to Favorites menu when opening form 
            For Each item As String In My.Settings.favList
                Dim item1 As New ToolStripMenuItem
                item1.Text = item.ToString
                ToolStripMenuItem4.DropDownItems.Add(item1)
            Next

            'Add Click Event handler for each Favorite link ToolStripMenuItem 
            For Each C As ToolStripMenuItem In ToolStripMenuItem4.DropDownItems
                AddHandler C.Click, AddressOf ToolStripMenuItem_Click
            Next
        End Sub
        'Add item to Favorites menu and FavList Settings 
        Private Sub ToolStripMenuItem18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
            Dim item1 As New ToolStripMenuItem
            item1.Text = WebBrowser1.Url.ToString
            ToolStripMenuItem4.DropDownItems.Add(item1)

            My.Settings.favList.Add(WebBrowser1.Url.ToString)
        End Sub

        'Open faverite link when selecting link item from Faverite menu 
        Private Sub ToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            WebBrowser1.Navigate(sender.ToString)
        End Sub

        'Save Settings when closing form 
        Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
            My.Settings.Save()
        End Sub

    Monday, October 13, 2008 5:43 PM
  • jackdelamare said:

    The solution worked ok but I had to add it again as there were many errors, so I added a whole new menustrip. Anyhow, I have added it and the favourites bar works, but the add button does not. Here is the code I currently have, as you can see it's exactly what you wrote above, so I'm unsure why add isn't working.

     
        'Add item to Favorites menu and FavList Settings 
        Private Sub ToolStripMenuItem18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
    (-> Please try changing to ToolStripMenuItem18)
            Dim item1 As New ToolStripMenuItem
            item1.Text = WebBrowser1.Url.ToString
            ToolStripMenuItem4.DropDownItems.Add(item1)

            My.Settings.favList.Add(WebBrowser1.Url.ToString)
        End Sub


    I apply your code to my sample project and it works fine. Please double check.
    • Marked as answer by jackdelamare Tuesday, October 14, 2008 8:06 PM
    Tuesday, October 14, 2008 1:05 PM
  • Martin, you are a genius! Works perfectly, and this is in the next build of Teega.

    Thanks :D
    Tuesday, October 14, 2008 8:08 PM
  • This is actually very useful to me. i however have failed to get the system to work. when i run my program, the form1_load event occours, and it begins to load the following code:

    Private Sub FormWebBrowser_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load     
            WebBrowser.Navigate(My.Settings.HomePage)     
        
            For Each item As String In My.Settings.favList     
                Dim item1 As New ToolStripMenuItem     
                itemitem1.Text = item.ToString     
                FavouritesToolStripMenuItem.DropDownItems.Add(item1)     
            Next     
        
            For Each C As ToolStripMenuItem In FavouritesToolStripMenuItem.DropDownItems     
                AddHandler C.Click, AddressOf FavouritesToolStripMenuItem_Click     
            Next     
        
        End Sub    
     

    The error that occours looks like the following:

    Private Sub FluidWebBrowser_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
            WebBrowser.Navigate(My.Settings.HomePage)  
     
            For Each item As String In My.Settings.favList  
                Dim item1 As New ToolStripMenuItem  
                itemitem1.Text = item.ToString  
                FavouritesToolStripMenuItem.DropDownItems.Add(item1)  
            Next  
     
            For Each C As ToolStripMenuItem In FavouritesToolStripMenuItem.DropDownItems  
                AddHandler C.Click, AddressOf FavouritesToolStripMenuItem_Click  
            Next  
     
        End Sub 

    The highlighted text is given the following error code:

    Unable to cast object of type 'System.Windows.Forms.ToolStripSeparator' to type 'System.Windows.Forms.ToolStripMenuItem'.

    if anyone can explain this, i would be greatful!

    cheers, nick

    EDIT: first use of these forums, what is the deal with the red and blue highlighting in my code windows? is it highlighting a mistake in my code? because that part of the code runs fine...


    www.makeshiftfilms.com.au
    • Edited by nicky g Thursday, October 23, 2008 5:37 AM noticed blue and red highlight in code window created by forum
    Thursday, October 23, 2008 5:35 AM
  • nicky g said:

    Private Sub FluidWebBrowser_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
            WebBrowser.Navigate(My.Settings.HomePage)  
     
            For Each item As String In My.Settings.favList  
                Dim item1 As New ToolStripMenuItem  
                itemitem1.Text = item.ToString  
                FavouritesToolStripMenuItem.DropDownItems.Add(item1)  
            Next  
     
            For Each C As ToolStripMenuItem In FavouritesToolStripMenuItem.DropDownItems  
                AddHandler C.Click, AddressOf FavouritesToolStripMenuItem_Click  
            Next  
     
        End Sub 

    The highlighted text is given the following error code:
    Unable to cast object of type 'System.Windows.Forms.ToolStripSeparator' to type 'System.Windows.Forms.ToolStripMenuItem'.

    if anyone can explain this, i would be greatful!


    Redirect to this thread:
    http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/c7165f52-8e16-453c-a906-408588a36eaa/
    Thursday, October 30, 2008 5:27 AM
  • Martin,

    Is there any way you could show me how to put together a dialog for deleting favorites???
    Any help from anyone would be appreciated.

    Thanks in advance,
    MAJAN
    Sunday, March 15, 2009 6:47 PM
  • MAJAN said:

    Martin,

    Is there any way you could show me how to put together a dialog for deleting favorites???
    Any help from anyone would be appreciated.

    Thanks in advance,
    MAJAN



    This would also help me.
    Sunday, March 22, 2009 2:10 PM
  • MAJAN said:
    Is there any way you could show me how to put together a dialog for deleting favorites?


    Hi MAJAN abd Jack,

    Please check the following completed code sample.
    I have added the Delete feature for Favorites.
    Right-click a ToolStripMenuItem, then MessageBox will prompt deletion confirmation.

    Public Class Form1  
     
        Private Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load  
            ToolStripMenuItem1.Text = "Favorites" 
            ToolStripMenuItem2.Text = "Add" 
            WebBrowser1.Navigate("http://www.microsoft.com")  
     
            ' Load Settings to Favorites menu when opening form  
            For Each item As String In My.Settings.favList  
                Dim item1 As New ToolStripMenuItem  
                item1.Text = item.ToString  
                ToolStripMenuItem1.DropDownItems.Add(item1)  
            Next 
            Call AddHandlers()  
        End Sub 
     
        ' This Sub will be called multiple times  
        Private Sub AddHandlers()  
            'Add Click and RightClick Event handler for each Favorite link ToolStripMenuItem  
            Application.DoEvents()  
            For Each C As ToolStripItem In ToolStripMenuItem1.DropDownItems  
                If TypeOf (C) Is ToolStripMenuItem Then 
                    AddHandler C.Click, AddressOf ToolStripMenuItem_Click  
                    AddHandler C.MouseDown, AddressOf ToolStripMenuItem_MouseDown  
                End If 
            Next 
        End Sub 
     
        'Right-Click event handler for each ToolStripMenuItem: Delete faverite item  
        Private Sub ToolStripMenuItem_MouseDown(ByVal sender As System.ObjectByVal e As System.Windows.Forms.MouseEventArgs)  
            If (e.Button = Windows.Forms.MouseButtons.Right) Then 
                Dim del As Boolean = MessageBox.Show("Do you want to delete " & DirectCast(sender, ToolStripMenuItem).ToString, "Title", MessageBoxButtons.YesNo)  
                If del = True Then 
                    ToolStripMenuItem1.DropDownItems.Remove(DirectCast(sender, ToolStripMenuItem))  
                    My.Settings.favList.Remove(DirectCast(sender, ToolStripMenuItem).ToString)  
                    Call AddHandlers()  
                End If 
            End If 
        End Sub 
     
        'Click event handler for each ToolStripMenuItem: Open faverite item  
        Private Sub ToolStripMenuItem_Click(ByVal sender As ObjectByVal e As System.EventArgs)  
            WebBrowser1.Navigate(DirectCast(sender, ToolStripMenuItem).ToString)  
        End Sub 
     
        'Add item to Favorites menu and FavList Settings  
        Private Sub ToolStripMenuItem2_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click  
            Dim item1 As New ToolStripMenuItem  
            item1.Text = WebBrowser1.Url.ToString  
            ToolStripMenuItem1.DropDownItems.Add(item1)  
            My.Settings.favList.Add(WebBrowser1.Url.ToString)  
            Call AddHandlers()  
        End Sub 
     
        'Save Settings when closing form  
        Private Sub Form1_FormClosed(ByVal sender As System.ObjectByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed  
            My.Settings.Save()  
        End Sub 
     
    End Class 


    Best regards,
    Martin Xie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, March 25, 2009 7:23 AM
  • Private Sub BookmarkThisPageToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BookmarkThisPageToolStripMenuItem.Click
            Dim url As Uri = New Uri(ComboBox1.Text)

            If url.HostNameType = UriHostNameType.Dns Then
                ' Get the URL of the favicon
                ' url.Host will return such string as www.google.com
                Dim iconURL = "http://" & url.Host & "/favicon.ico"

                ' Download the favicon
                Dim request As System.Net.WebRequest = System.Net.HttpWebRequest.Create(iconURL)
                Dim response As System.Net.HttpWebResponse = request.GetResponse()
                Dim stream As System.IO.Stream = response.GetResponseStream()
                Dim favicon = Image.FromStream(stream)

                



                If Book1.ToolTipText = "" Then
                    Book1.ToolTipText = ("")
                    Book1.ToolTipText = (ComboBox1.Text)
                    Book1.Text = (TextBox3.Text)
                    

                    Book1.Visible = True
                    Separator1.Visible = True
                    My.Settings.Book1 = Book1.ToolTipText
                    My.Settings.Empty1 = Book1.Text
                    Book1.Image = favicon




                ElseIf Book2.ToolTipText = ("") Then
                    Book2.Image = favicon
                    Book2.ToolTipText = (ComboBox1.Text)
                    Book2.Text = (TextBox3.Text)
                    Book2.Visible = True
                    My.Settings.Book2 = Book2.ToolTipText
                    My.Settings.Empty2 = Book2.Text
                    

                ElseIf Book3.ToolTipText = ("") Then
                    Book3.Image = favicon
                    Book3.ToolTipText = (ComboBox1.Text)
                    Book3.Text = (TextBox3.Text)
                    Book3.Visible = True
                    My.Settings.Book3 = Book3.ToolTipText
                    My.Settings.Empty3 = Book2.Text
                   

                ElseIf Book4.ToolTipText = ("") Then
                    Book4.Image = favicon
                    Book4.ToolTipText = (ComboBox1.Text)
                    Book4.Text = (TextBox3.Text)
                    Book4.Visible = True
                    My.Settings.book4 = Book4.ToolTipText
                    My.Settings.Empty4 = Book4.Text
                    

                ElseIf Book5.ToolTipText = ("") Then
                    Book5.Image = favicon
                    Book5.ToolTipText = (ComboBox1.Text)
                    Book5.Text = (TextBox3.Text)
                    Book5.Visible = True
                    My.Settings.Book5 = Book5.ToolTipText
                    My.Settings.Empty5 = Book5.Text
                    

                ElseIf Book6.ToolTipText = ("") Then
                    Book6.Image = favicon
                    Book6.ToolTipText = (ComboBox1.Text)
                    Book6.Text = (TextBox3.Text)
                    Book6.Visible = True
                    My.Settings.Book6 = Book6.ToolTipText
                    My.Settings.Empty6 = Book6.Text
                    

                ElseIf Book7.ToolTipText = ("") Then
                    Book7.Image = favicon
                    Book7.ToolTipText = (ComboBox1.Text)
                    Book7.Text = (TextBox3.Text)
                    Book7.Visible = True
                    My.Settings.Book7 = Book7.ToolTipText
                    My.Settings.Empty7 = Book7.Text
                    

                ElseIf Book8.ToolTipText = ("") Then
                    Book8.Image = favicon
                    Book8.ToolTipText = (ComboBox1.Text)
                    Book8.Text = (TextBox3.Text)
                    Book8.Visible = True
                    My.Settings.Book8 = Book8.ToolTipText
                    My.Settings.Empty8 = Book8.Text
                   

                ElseIf Book9.ToolTipText = ("") Then
                    Book9.Image = favicon
                    Book9.ToolTipText = (ComboBox1.Text)
                    Book9.Text = (TextBox3.Text)
                    Book9.Visible = True
                    My.Settings.Book9 = Book9.ToolTipText
                    My.Settings.Empty9 = Book9.Text
                    

                ElseIf Book10.ToolTipText = ("") Then
                    Book10.Image = favicon
                    Book10.ToolTipText = (ComboBox1.Text)
                    Book10.Text = (TextBox3.Text)
                    Book10.Visible = True
                    My.Settings.Book10 = Book10.ToolTipText
                    My.Settings.Empty10 = Book10.Text
                    

                ElseIf Book11.ToolTipText = ("") Then
                    Book11.Image = favicon
                    Book11.ToolTipText = (ComboBox1.Text)
                    Book11.Text = (TextBox3.Text)
                    Book11.Visible = True
                    My.Settings.Book11 = Book11.ToolTipText
                    My.Settings.Empty11 = Book11.Text
                   
                ElseIf Book12.ToolTipText = ("") Then
                    Book12.Image = favicon
                    Book12.ToolTipText = (ComboBox1.Text)
                    Book12.Text = (TextBox3.Text)
                    Book12.Visible = True
                    My.Settings.Book12 = Book12.ToolTipText
                    My.Settings.Empty12 = Book12.Text
                    

                ElseIf Book13.ToolTipText = ("") Then
                    Book13.Image = favicon
                    Book13.ToolTipText = (ComboBox1.Text)
                    Book13.Text = (TextBox3.Text)
                    Book13.Visible = True
                    My.Settings.Book13 = Book13.ToolTipText
                    My.Settings.Empty13 = Book13.Text
                    

                ElseIf Book14.ToolTipText = ("") Then
                    Book14.Image = favicon
                    Book14.ToolTipText = (ComboBox1.Text)
                    Book14.Text = (TextBox3.Text)
                    Book14.Visible = True
                    My.Settings.Book14 = Book14.ToolTipText
                    My.Settings.Empty14 = Book14.Text
                   

                ElseIf Book15.ToolTipText = ("") Then
                    Book15.Image = favicon
                    Book15.ToolTipText = (ComboBox1.Text)
                    Book15.Text = (TextBox3.Text)
                    Book15.Visible = True
                    My.Settings.Book15 = Book15.ToolTipText
                    My.Settings.Empty15 = Book15.Text
                    
                ElseIf Book16.ToolTipText = ("") Then
                    Book16.Image = favicon
                    Book16.ToolTipText = (ComboBox1.Text)
                    Book16.Text = (TextBox3.Text)
                    Book16.Visible = True
                    My.Settings.Book16 = Book16.ToolTipText
                    My.Settings.Empty16 = Book16.Text
                   

                ElseIf Book17.ToolTipText = ("") Then
                    Book17.Image = favicon
                    Book17.ToolTipText = (ComboBox1.Text)
                    Book17.Text = (TextBox3.Text)
                    Book17.Visible = True
                    My.Settings.Book17 = Book17.ToolTipText
                    My.Settings.Empty17 = Book17.Text
                    
                ElseIf Book18.ToolTipText = ("") Then
                    Book18.Image = favicon
                    Book18.ToolTipText = (ComboBox1.Text)
                    Book18.Text = (TextBox3.Text)
                    Book18.Visible = True
                    My.Settings.Book18 = Book18.ToolTipText
                    My.Settings.Empty18 = Book18.Text
                    

                ElseIf Book1.ToolTipText = ("") Then
                    Book19.Image = favicon
                    Book19.ToolTipText = (ComboBox1.Text)
                    Book19.Text = (TextBox3.Text)
                    Book19.Visible = True
                    My.Settings.Book19 = Book19.ToolTipText
                    My.Settings.Empty19 = Book19.Text
                   

                ElseIf Book20.ToolTipText = ("") Then
                    Book20.Image = favicon
                    Book20.ToolTipText = (ComboBox1.Text)
                    Book20.Text = (TextBox3.Text)
                    Book20.Visible = True
                    My.Settings.Book20 = Book20.ToolTipText
                    My.Settings.Empty20 = Book20.Text

                End If
            End If
            My.Settings.Save()
            My.Settings.Reload()



    and the load 




     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            WebBrowser1.Navigate("https://login.yahoo.com/config/mail?.intl=us/")
            Book1.Text = My.Settings.Book1
            Book1.ToolTipText = My.Settings.Book1
            Book1.Visible = True


            Book2.Text = My.Settings.Book2
            Book2.ToolTipText = My.Settings.Book2
            Book2.Visible = True


            Book3.Text = My.Settings.Book3
            Book3.ToolTipText = My.Settings.Book3
            Book3.Visible = True


            Book4.Text = My.Settings.book4
            Book4.ToolTipText = My.Settings.book4
            Book4.Visible = True


            Book5.Text = My.Settings.Book5
            Book5.ToolTipText = My.Settings.Book5
            Book5.Visible = True


            Book6.Text = My.Settings.Book6
            Book6.ToolTipText = My.Settings.Book6
            Book6.Visible = True


            Book7.Text = My.Settings.Book7
            Book7.ToolTipText = My.Settings.Book7
            Book7.Visible = True


            Book8.Text = My.Settings.Book8
            Book8.ToolTipText = My.Settings.Book8
            Book8.Visible = True


            Book9.Text = My.Settings.Book9
            Book9.ToolTipText = My.Settings.Book9
            Book9.Visible = True


            Book10.Text = My.Settings.Book10
            Book10.ToolTipText = My.Settings.Book10
            Book10.Visible = True


            Book11.Text = My.Settings.Book11
            Book11.ToolTipText = My.Settings.Book11
            Book11.Visible = True


            Book12.Text = My.Settings.Book12
            Book12.ToolTipText = My.Settings.Book12
            Book12.Visible = True


            Book13.Text = My.Settings.Book13
            Book13.ToolTipText = My.Settings.Book13
            Book13.Visible = True


            Book14.Text = My.Settings.Book14
            Book14.ToolTipText = My.Settings.Book14
            Book14.Visible = True


            Book15.Text = My.Settings.Book15
            Book15.ToolTipText = My.Settings.Book15
            Book15.Visible = True


            Book16.Text = My.Settings.Book16
            Book16.ToolTipText = My.Settings.Book16
            Book16.Visible = True


            Book17.Text = My.Settings.Book17
            Book17.ToolTipText = My.Settings.Book17
            Book17.Visible = True


            Book18.Text = My.Settings.Book18
            Book18.ToolTipText = My.Settings.Book18
            Book18.Visible = True


            Book19.Text = My.Settings.Book19
            Book19.ToolTipText = My.Settings.Book19
            Book19.Visible = True


            Book20.Text = My.Settings.Book20
            Book20.ToolTipText = My.Settings.Book20
            Book20.Visible = True


            If My.Settings.Book1.Contains(".") = False Then
                Book1.Visible = False
            Else
                Book1.Visible = True
            End If

            If My.Settings.Book2.Contains(".") = False Then
                Book2.Visible = False
            Else
                Book2.Visible = True
            End If

            If My.Settings.Book1.Contains(".") = False Then
                Book1.Visible = False
            Else
                Book1.Visible = True
            End If

            If My.Settings.Book2.Contains(".") = False Then
                Book2.Visible = False
            Else
                Book2.Visible = True
            End If

            If My.Settings.Book1.Contains(".") = False Then
                Book1.Visible = False
            Else
                Book1.Visible = True
            End If

            If My.Settings.Book2.Contains(".") = False Then
                Book2.Visible = False
            Else
                Book2.Visible = True
            End If

            If My.Settings.Book1.Contains(".") = False Then
                Book1.Visible = False
            Else
                Book1.Visible = True
            End If

            If My.Settings.Book2.Contains(".") = False Then
                Book2.Visible = False
            Else
                Book2.Visible = True
            End If

            If My.Settings.Book1.Contains(".") = False Then
                Book1.Visible = False
            Else
                Book1.Visible = True
            End If

            If My.Settings.Book2.Contains(".") = False Then
                Book2.Visible = False
            Else
                Book2.Visible = True
            End If

            If My.Settings.Book3.Contains(".") = False Then
                Book3.Visible = False
            Else
                Book3.Visible = True
            End If

            If My.Settings.book4.Contains(".") = False Then
                Book4.Visible = False
            Else
                Book4.Visible = True
            End If

            If My.Settings.Book5.Contains(".") = False Then
                Book5.Visible = False
            Else
                Book5.Visible = True
            End If

            If My.Settings.Book6.Contains(".") = False Then
                Book6.Visible = False
            Else
                Book6.Visible = True
            End If

            If My.Settings.Book7.Contains(".") = False Then
                Book7.Visible = False
            Else
                Book7.Visible = True
            End If

            If My.Settings.Book8.Contains(".") = False Then
                Book8.Visible = False
            Else
                Book8.Visible = True
            End If

            If My.Settings.Book9.Contains(".") = False Then
                Book9.Visible = False
            Else
                Book9.Visible = True
            End If

            If My.Settings.Book10.Contains(".") = False Then
                Book10.Visible = False
            Else
                Book10.Visible = True
            End If

            If My.Settings.Book11.Contains(".") = False Then
                Book11.Visible = False
            Else
                Book11.Visible = True
            End If

            If My.Settings.Book12.Contains(".") = False Then
                Book12.Visible = False
            Else
                Book12.Visible = True
            End If

            If My.Settings.Book13.Contains(".") = False Then
                Book13.Visible = False
            Else
                Book13.Visible = True
            End If

            If My.Settings.Book14.Contains(".") = False Then
                Book14.Visible = False
            Else
                Book14.Visible = True
            End If

            If My.Settings.Book15.Contains(".") = False Then
                Book15.Visible = False
            Else
                Book15.Visible = True
            End If

            If My.Settings.Book16.Contains(".") = False Then
                Book16.Visible = False
            Else
                Book16.Visible = True
            End If

            If My.Settings.Book17.Contains(".") = False Then
                Book17.Visible = False
            Else
                Book17.Visible = True
            End If

            If My.Settings.Book18.Contains(".") = False Then
                Book18.Visible = False
            Else
                Book18.Visible = True
            End If

            If My.Settings.Book19.Contains(".") = False Then
                Book19.Visible = False
            Else
                Book19.Visible = True
            End If

            If My.Settings.Book20.Contains(".") = False Then
                Book20.Visible = False
            Else
                Book20.Visible = True
            End If
    • Proposed as answer by Tj.. _ Friday, April 3, 2009 3:05 AM
    Friday, April 3, 2009 3:04 AM
  • hiii bro Martin
    i have error in my project and need help really...
    can u check that bro
    <img src="http://i42.tinypic.com/35cpxxt.jpg"/>

    thx



    Mido
    Do your best to be the best (I will be inactive in the forum the for 2 weeks cuz my midterm exams) My e-mails:speedman2027@yahoo.com & speedman2202@hotmail.com Mido
    • Edited by Martin Xie - MSFT Wednesday, April 15, 2009 11:06 AM Modify HTML View code to display an illustration on your post.
    • Proposed as answer by Tj.. _ Saturday, April 18, 2009 1:53 AM
    Tuesday, April 14, 2009 11:01 AM
  • Hi Mido,

    Please add at least one item to My.Settings.FavList like this:
            My.Settings.FavList = New System.Collections.Specialized.StringCollection
            My.Settings.FavList.Add("http://www.microsoft.com")
    Then this error will go away.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, April 15, 2009 11:13 AM
  • hiii bro Martin
    sry if i disturbed u ...but iam in a bad need of ur help to complete my project cuz soonly i will intriduce it for my head department .......so there's another problem come up



    Mido
    Do your best to be the best (I will be inactive in the forum the for 2 weeks cuz my midterm exams) My e-mails:speedman2027@yahoo.com & speedman2202@hotmail.com Mido
    Tuesday, April 21, 2009 9:09 AM
  • Hi Mido,

    I don't see any warning or error message from your illustration.

    However, I have sent my sample project (How to add Favorites to web browser) to your Emails: speedman2027@yahoo.com & speedman2202@hotmail.com. Please check it.

    Best regards,
    Martin Xie
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, April 22, 2009 3:32 AM
  • thx bro Martin for ur great efforts to help me

    i need to tell me bro how to show web page source.....
    iam now work in ur simple project.....thx bro

    Mido
    Do your best to be the best (I will be inactive in the forum the for 2 weeks cuz my midterm exams) My e-mails:speedman2027@yahoo.com & speedman2202@hotmail.com Mido
    Friday, April 24, 2009 7:14 PM
  • Hi Mido,

    You're welcome.

    Here is the code sample for you to check:
            'Retrieve HTML source code
            Dim htmlSourceCode As String = WebBrowser1.DocumentText.ToString
            ' Show on RichTextBox
            RichTextBox1.Text = htmlSourceCode
    
            'Retrieve page body content
            Dim BodyContentText As String = WebBrowser1.Document.Body.InnerText.ToString
            RichtextBox1.text = htmlSourceCode

    Best regards,
    Martin Xie
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Monday, April 27, 2009 4:28 AM
  • hiii bro Martin

    i will try ur code ...but there problem.....can u check that plz
    but that for one webbrowser not tabbed one.....
    thxt any way bro


    Mido


    Do your best to be the best (I will be inactive in the forum the for 2 weeks cuz my midterm exams) My e-mails:speedman2027@yahoo.com & speedman2202@hotmail.com Mido
    Monday, April 27, 2009 2:23 PM
  • Please make sure the following are done:
    1. There are at least one item in My.Settings.FavList object.
    2. The webBorwser object "browser" has loaded a web page.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Tuesday, April 28, 2009 7:19 AM
  • hiii bro Martin
    i try ur last project and its work successfully with me ....but there's something wrong...when i press on add button the url already add to the list but i found that my browser navigate "add" as a link.....i dont know why but the site add to list and save also ......there my pic i wanna u see





    and if u need see my source code of my project or send it to u....u can just tell me...cuz bro iam have about one week to finish my project......any way thx soo much for ur great efforts to help me and also help the other...u really the  best

    sry bro there's another problem
    when i right click on the favorite item.....i found that the massege box show and at first time i press its remove the item but its show again and if i click yes or no its do no thing ......just show for 6 times then its disappear.....every time do that when i remove any item ....and this problem in ur simple project also......can u plz tell me how to fix that........
     
    thx

    Mido
    Do your best to be the best (I will be inactive in the forum the for 2 weeks cuz my midterm exams) My e-mails:speedman2027@yahoo.com & speedman2202@hotmail.com Mido
    • Edited by speedman2202 Tuesday, April 28, 2009 10:34 PM another probelm forget t o write
    Tuesday, April 28, 2009 10:07 PM
  • Hi Mido,

    The 1st issue is resulted from your program design. It seems that you place the "Add" button under the Favorite MenuItem, then the "Add" button maybe has the same routine with the other Favorite links.
    In my sample project, I place the "Add" button beside (not under) the Favorite MenuItem. Please check my sample project design and related source code again. Or you can send your project (zip package) to me for checking. Thanks!
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Wednesday, April 29, 2009 5:36 AM
  • hiii bro Martin

    i send u a simple of my project and w8 ur replay...and need ask about how to make send link in my browser that open outlook express and put the url that in the combox URL  and in the massage and and the user just enter the e-mail that he want to send it's link and also can u provide me codes of (copy,pase,cut and delete)  and also how to edit my home page...i was have code but its not working can u provide me it....that's all and iam appreciate ur great efforts for helping me and other's also

    thx any way bro

    Mido
    Do your best to be the best My e-mails:speedman2027@yahoo.com & speedman2202@hotmail.com Mido
    • Edited by speedman2202 Saturday, May 2, 2009 12:26 AM add another problem
    Friday, May 1, 2009 1:32 PM
  • Hi Martin.

    I have tried using your code for deleting bookmarks from my favorites list but I am having difficulty with it. For some odd reason it deletes the bookmark even if I click the No button in the dialog box. "The if Del = True" condition is there so I am surprised it is doing this.
    Any ideas?

    CBC Design.

    PS: I only started learning VB this past weekend so I am very much a newbie. Please bare that in mind if you reply. Thanks.
    Thursday, May 28, 2009 4:29 PM
  • This problem was the reason that I started to become active in the newsgroups.

    I'm a little bit late, but I got this from Herfried K Wagner

    \\\ 
     Me.WebBrowser1.Navigate( _ 
         "about:<html><body onload=""javascript:" & _ 
         "window.external.addFavorite(" & _ 
         "'http://www.mvps.org/dotnet', 'Description.'" & : 
         )""></body></html>" _ 

    ///

    Maybe somebody can use it when he is searching for it

    Cor

    Thursday, May 28, 2009 5:00 PM
  • Hay,

    Could any 1 be able to help me add this to my tabbed web browser in VB2008
    Sunday, August 23, 2009 6:53 PM
  • This is a sample project of a simple tabbed webbrowser maybe download it and have a look Tabbed Web browser project.zip It uses a combobox to store favorites using this method .
    coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
    Please format the code in your posts with the button . Makes it easier to read .
    • Edited by bdbodger Sunday, August 23, 2009 7:02 PM
    Sunday, August 23, 2009 6:57 PM
  • Hey Friend,

    I went through all of your code and everything seems to be ok but i need one help that how can i add features of History of visited sites url and print option of web content !!!!!!

    Please help me out
    Friday, November 6, 2009 9:37 PM
  • Hi dreamguy,

     

    "but i need one help that how can i add features of History of visited sites url and print option of web content?"
    ->

    1. The History feature is siimilar to the Favorite feature. You still need a Collection type object used to store current URL. 
    But the difference is that you need execute "Adding URL to Collection" action (such as My.Settings.favList.Add(WebBrowser1.Url.ToString)) in WebBrowser.DocumentCompleted Event.

    Additionally, you can check and eliminate eduplicate history URL items before adding to collection.

    WebBrowser.DocumentCompleted Event
    http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documentcompleted.aspx


    2. The WebBrowser.Print Method is used to print the document currently displayed in the WebBrowser control using the current print and page settings.
    http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.print.aspx


    Best regards,
    Martin Xie

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, November 9, 2009 8:32 AM
  • I know this is an old topic, but I have used your code and I have a problem. I right click my favorite and it shows the message box and i delete it and it works. But the second time i right click to delete the messagebox comes up twice, and the third time it comes up 4 times, and exponentially grows. Can you tell me what the problem is?

    Thanx,
    cwarcarblue11
    Thursday, February 11, 2010 8:34 PM
  • hello cwarcarblue11 ,

    i was have the same problem but the best solution for u just remove the code that request to show masseges box and run the program when u press right click , will del with any probelm , and that best for u but that all i can say and sry if i didnt provide u the code to del cuz iam not setup da vb2008 , but may da problem from that u define the variable as boolen , that may da problem , hope i helped

    best regardless

    Mido

    I am not a professional programmer , but i am student want gain more knowledge , Because the science have no limits and we will learn until we die's Thanks to MS to create this great forum Mido
    Sunday, February 14, 2010 2:54 AM
  • Hi Martin Xie, im new to this kind of stuff, im tring to learn things while i correct erros i find when i copy someones code. Howerver my problem was creating a new Setting idk what is a Value =/ and so i cant finish folowing the thing writen in your post, i would thanks if you could give me some exemples =D
    thx for your atention Lucas
    Thursday, February 17, 2011 7:09 PM
  • hi can u send your project to my email as well ?!!! i really need it urgently i got some problems, the 1st problem related to ToolStripMenuItem1, it says its not declared. the same goes to ToolStripMenuItem2 also the other problem regaring this line of code : WebBrowser1.Navigate("http://www.microsoft.com") regarding "WebBrowser1" it says refernce to a non shared-member requires an object reference thanx in advance
    Wednesday, March 23, 2011 1:06 PM
  • hi can u send your project to my email as well ?!!! i really need it urgently i got some problems, the 1st problem related to ToolStripMenuItem1, it says its not declared. the same goes to ToolStripMenuItem2 also the other problem regaring this line of code : WebBrowser1.Navigate("http://www.microsoft.com") regarding "WebBrowser1" it says refernce to a non shared-member requires an object reference here is my email : binghiz@hotmail.com thanx in advance
    Wednesday, March 23, 2011 1:07 PM
  • I'm trying to make this for "history". But when ever I go to a link, it add's each link twice, could someone please help, or explain why this is happening!
    • Edited by Stewie_ Friday, February 17, 2012 7:29 PM
    Friday, February 17, 2012 7:28 PM