Answered by:
Adding Favourites to Web Browser

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 belowName 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.Object, ByVal 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.Object, ByVal 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 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 End Class Illustration:
http://social.msdn.microsoft.com/forums/en-US/Vsexpressvb/thread/8ea89e24-c60b-4ce5-a0de-39217f15b1b8/
In addition, if you feel interested in "How to create own Web Browser", please check the following thread:
Glad to help you.
If I misunderstood you, please let me know. :)
Best regards,
Martin Xie- Marked as answer by Martin Xie - MSFT Wednesday, September 10, 2008 5:12 AM
- Edited by Martin Xie - MSFT Thursday, February 5, 2009 4:02 AM
Tuesday, September 9, 2008 6:37 AM -
jackdelamare said:How to assign value for the favList Settings variable of StringCollection type?What would I write in for the value?
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 belowName 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.Object, ByVal 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.Object, ByVal 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 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 End Class Illustration:
http://social.msdn.microsoft.com/forums/en-US/Vsexpressvb/thread/8ea89e24-c60b-4ce5-a0de-39217f15b1b8/
In addition, if you feel interested in "How to create own Web Browser", please check the following thread:
Glad to help you.
If I misunderstood you, please let me know. :)
Best regards,
Martin Xie- Marked as answer by Martin Xie - MSFT Wednesday, September 10, 2008 5:12 AM
- Edited by Martin Xie - MSFT Thursday, February 5, 2009 4:02 AM
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 belowName 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:How to assign value for the favList Settings variable of StringCollection type?What would I write in for the value?
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 -
-
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 C 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- Edited by Martin Xie - MSFT Wednesday, February 18, 2009 8:40 AM Refine.
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,
MAJANSunday, 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.- Marked as answer by Martin Xie - MSFT Wednesday, March 25, 2009 7:11 AM
- Unmarked as answer by Martin Xie - MSFT Wednesday, March 25, 2009 7:16 AM
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.Object, ByVal 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.Object, ByVal 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 Object, ByVal 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.Object, ByVal 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.Object, ByVal 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.ClickDim 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.comDim iconURL = "http://" & url.Host & "/favicon.ico"' Download the faviconDim 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 = "" ThenBook1.ToolTipText = ("")Book1.ToolTipText = (ComboBox1.Text)Book1.Text = (TextBox3.Text)Book1.Visible = TrueSeparator1.Visible = TrueMy.Settings.Book1 = Book1.ToolTipTextMy.Settings.Empty1 = Book1.TextBook1.Image = faviconElseIf Book2.ToolTipText = ("") ThenBook2.Image = faviconBook2.ToolTipText = (ComboBox1.Text)Book2.Text = (TextBox3.Text)Book2.Visible = TrueMy.Settings.Book2 = Book2.ToolTipTextMy.Settings.Empty2 = Book2.TextElseIf Book3.ToolTipText = ("") ThenBook3.Image = faviconBook3.ToolTipText = (ComboBox1.Text)Book3.Text = (TextBox3.Text)Book3.Visible = TrueMy.Settings.Book3 = Book3.ToolTipTextMy.Settings.Empty3 = Book2.TextElseIf Book4.ToolTipText = ("") ThenBook4.Image = faviconBook4.ToolTipText = (ComboBox1.Text)Book4.Text = (TextBox3.Text)Book4.Visible = TrueMy.Settings.book4 = Book4.ToolTipTextMy.Settings.Empty4 = Book4.TextElseIf Book5.ToolTipText = ("") ThenBook5.Image = faviconBook5.ToolTipText = (ComboBox1.Text)Book5.Text = (TextBox3.Text)Book5.Visible = TrueMy.Settings.Book5 = Book5.ToolTipTextMy.Settings.Empty5 = Book5.TextElseIf Book6.ToolTipText = ("") ThenBook6.Image = faviconBook6.ToolTipText = (ComboBox1.Text)Book6.Text = (TextBox3.Text)Book6.Visible = TrueMy.Settings.Book6 = Book6.ToolTipTextMy.Settings.Empty6 = Book6.TextElseIf Book7.ToolTipText = ("") ThenBook7.Image = faviconBook7.ToolTipText = (ComboBox1.Text)Book7.Text = (TextBox3.Text)Book7.Visible = TrueMy.Settings.Book7 = Book7.ToolTipTextMy.Settings.Empty7 = Book7.TextElseIf Book8.ToolTipText = ("") ThenBook8.Image = faviconBook8.ToolTipText = (ComboBox1.Text)Book8.Text = (TextBox3.Text)Book8.Visible = TrueMy.Settings.Book8 = Book8.ToolTipTextMy.Settings.Empty8 = Book8.TextElseIf Book9.ToolTipText = ("") ThenBook9.Image = faviconBook9.ToolTipText = (ComboBox1.Text)Book9.Text = (TextBox3.Text)Book9.Visible = TrueMy.Settings.Book9 = Book9.ToolTipTextMy.Settings.Empty9 = Book9.TextElseIf Book10.ToolTipText = ("") ThenBook10.Image = faviconBook10.ToolTipText = (ComboBox1.Text)Book10.Text = (TextBox3.Text)Book10.Visible = TrueMy.Settings.Book10 = Book10.ToolTipTextMy.Settings.Empty10 = Book10.TextElseIf Book11.ToolTipText = ("") ThenBook11.Image = faviconBook11.ToolTipText = (ComboBox1.Text)Book11.Text = (TextBox3.Text)Book11.Visible = TrueMy.Settings.Book11 = Book11.ToolTipTextMy.Settings.Empty11 = Book11.TextElseIf Book12.ToolTipText = ("") ThenBook12.Image = faviconBook12.ToolTipText = (ComboBox1.Text)Book12.Text = (TextBox3.Text)Book12.Visible = TrueMy.Settings.Book12 = Book12.ToolTipTextMy.Settings.Empty12 = Book12.TextElseIf Book13.ToolTipText = ("") ThenBook13.Image = faviconBook13.ToolTipText = (ComboBox1.Text)Book13.Text = (TextBox3.Text)Book13.Visible = TrueMy.Settings.Book13 = Book13.ToolTipTextMy.Settings.Empty13 = Book13.TextElseIf Book14.ToolTipText = ("") ThenBook14.Image = faviconBook14.ToolTipText = (ComboBox1.Text)Book14.Text = (TextBox3.Text)Book14.Visible = TrueMy.Settings.Book14 = Book14.ToolTipTextMy.Settings.Empty14 = Book14.TextElseIf Book15.ToolTipText = ("") ThenBook15.Image = faviconBook15.ToolTipText = (ComboBox1.Text)Book15.Text = (TextBox3.Text)Book15.Visible = TrueMy.Settings.Book15 = Book15.ToolTipTextMy.Settings.Empty15 = Book15.TextElseIf Book16.ToolTipText = ("") ThenBook16.Image = faviconBook16.ToolTipText = (ComboBox1.Text)Book16.Text = (TextBox3.Text)Book16.Visible = TrueMy.Settings.Book16 = Book16.ToolTipTextMy.Settings.Empty16 = Book16.TextElseIf Book17.ToolTipText = ("") ThenBook17.Image = faviconBook17.ToolTipText = (ComboBox1.Text)Book17.Text = (TextBox3.Text)Book17.Visible = TrueMy.Settings.Book17 = Book17.ToolTipTextMy.Settings.Empty17 = Book17.TextElseIf Book18.ToolTipText = ("") ThenBook18.Image = faviconBook18.ToolTipText = (ComboBox1.Text)Book18.Text = (TextBox3.Text)Book18.Visible = TrueMy.Settings.Book18 = Book18.ToolTipTextMy.Settings.Empty18 = Book18.TextElseIf Book1.ToolTipText = ("") ThenBook19.Image = faviconBook19.ToolTipText = (ComboBox1.Text)Book19.Text = (TextBox3.Text)Book19.Visible = TrueMy.Settings.Book19 = Book19.ToolTipTextMy.Settings.Empty19 = Book19.TextElseIf Book20.ToolTipText = ("") ThenBook20.Image = faviconBook20.ToolTipText = (ComboBox1.Text)Book20.Text = (TextBox3.Text)Book20.Visible = TrueMy.Settings.Book20 = Book20.ToolTipTextMy.Settings.Empty20 = Book20.TextEnd IfEnd IfMy.Settings.Save()My.Settings.Reload()and the loadPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadWebBrowser1.Navigate("https://login.yahoo.com/config/mail?.intl=us/")Book1.Text = My.Settings.Book1Book1.ToolTipText = My.Settings.Book1Book1.Visible = TrueBook2.Text = My.Settings.Book2Book2.ToolTipText = My.Settings.Book2Book2.Visible = TrueBook3.Text = My.Settings.Book3Book3.ToolTipText = My.Settings.Book3Book3.Visible = TrueBook4.Text = My.Settings.book4Book4.ToolTipText = My.Settings.book4Book4.Visible = TrueBook5.Text = My.Settings.Book5Book5.ToolTipText = My.Settings.Book5Book5.Visible = TrueBook6.Text = My.Settings.Book6Book6.ToolTipText = My.Settings.Book6Book6.Visible = TrueBook7.Text = My.Settings.Book7Book7.ToolTipText = My.Settings.Book7Book7.Visible = TrueBook8.Text = My.Settings.Book8Book8.ToolTipText = My.Settings.Book8Book8.Visible = TrueBook9.Text = My.Settings.Book9Book9.ToolTipText = My.Settings.Book9Book9.Visible = TrueBook10.Text = My.Settings.Book10Book10.ToolTipText = My.Settings.Book10Book10.Visible = TrueBook11.Text = My.Settings.Book11Book11.ToolTipText = My.Settings.Book11Book11.Visible = TrueBook12.Text = My.Settings.Book12Book12.ToolTipText = My.Settings.Book12Book12.Visible = TrueBook13.Text = My.Settings.Book13Book13.ToolTipText = My.Settings.Book13Book13.Visible = TrueBook14.Text = My.Settings.Book14Book14.ToolTipText = My.Settings.Book14Book14.Visible = TrueBook15.Text = My.Settings.Book15Book15.ToolTipText = My.Settings.Book15Book15.Visible = TrueBook16.Text = My.Settings.Book16Book16.ToolTipText = My.Settings.Book16Book16.Visible = TrueBook17.Text = My.Settings.Book17Book17.ToolTipText = My.Settings.Book17Book17.Visible = TrueBook18.Text = My.Settings.Book18Book18.ToolTipText = My.Settings.Book18Book18.Visible = TrueBook19.Text = My.Settings.Book19Book19.ToolTipText = My.Settings.Book19Book19.Visible = TrueBook20.Text = My.Settings.Book20Book20.ToolTipText = My.Settings.Book20Book20.Visible = TrueIf My.Settings.Book1.Contains(".") = False ThenBook1.Visible = FalseElseBook1.Visible = TrueEnd IfIf My.Settings.Book2.Contains(".") = False ThenBook2.Visible = FalseElseBook2.Visible = TrueEnd IfIf My.Settings.Book1.Contains(".") = False ThenBook1.Visible = FalseElseBook1.Visible = TrueEnd IfIf My.Settings.Book2.Contains(".") = False ThenBook2.Visible = FalseElseBook2.Visible = TrueEnd IfIf My.Settings.Book1.Contains(".") = False ThenBook1.Visible = FalseElseBook1.Visible = TrueEnd IfIf My.Settings.Book2.Contains(".") = False ThenBook2.Visible = FalseElseBook2.Visible = TrueEnd IfIf My.Settings.Book1.Contains(".") = False ThenBook1.Visible = FalseElseBook1.Visible = TrueEnd IfIf My.Settings.Book2.Contains(".") = False ThenBook2.Visible = FalseElseBook2.Visible = TrueEnd IfIf My.Settings.Book1.Contains(".") = False ThenBook1.Visible = FalseElseBook1.Visible = TrueEnd IfIf My.Settings.Book2.Contains(".") = False ThenBook2.Visible = FalseElseBook2.Visible = TrueEnd IfIf My.Settings.Book3.Contains(".") = False ThenBook3.Visible = FalseElseBook3.Visible = TrueEnd IfIf My.Settings.book4.Contains(".") = False ThenBook4.Visible = FalseElseBook4.Visible = TrueEnd IfIf My.Settings.Book5.Contains(".") = False ThenBook5.Visible = FalseElseBook5.Visible = TrueEnd IfIf My.Settings.Book6.Contains(".") = False ThenBook6.Visible = FalseElseBook6.Visible = TrueEnd IfIf My.Settings.Book7.Contains(".") = False ThenBook7.Visible = FalseElseBook7.Visible = TrueEnd IfIf My.Settings.Book8.Contains(".") = False ThenBook8.Visible = FalseElseBook8.Visible = TrueEnd IfIf My.Settings.Book9.Contains(".") = False ThenBook9.Visible = FalseElseBook9.Visible = TrueEnd IfIf My.Settings.Book10.Contains(".") = False ThenBook10.Visible = FalseElseBook10.Visible = TrueEnd IfIf My.Settings.Book11.Contains(".") = False ThenBook11.Visible = FalseElseBook11.Visible = TrueEnd IfIf My.Settings.Book12.Contains(".") = False ThenBook12.Visible = FalseElseBook12.Visible = TrueEnd IfIf My.Settings.Book13.Contains(".") = False ThenBook13.Visible = FalseElseBook13.Visible = TrueEnd IfIf My.Settings.Book14.Contains(".") = False ThenBook14.Visible = FalseElseBook14.Visible = TrueEnd IfIf My.Settings.Book15.Contains(".") = False ThenBook15.Visible = FalseElseBook15.Visible = TrueEnd IfIf My.Settings.Book16.Contains(".") = False ThenBook16.Visible = FalseElseBook16.Visible = TrueEnd IfIf My.Settings.Book17.Contains(".") = False ThenBook17.Visible = FalseElseBook17.Visible = TrueEnd IfIf My.Settings.Book18.Contains(".") = False ThenBook18.Visible = FalseElseBook18.Visible = TrueEnd IfIf My.Settings.Book19.Contains(".") = False ThenBook19.Visible = FalseElseBook19.Visible = TrueEnd IfIf My.Settings.Book20.Contains(".") = False ThenBook20.Visible = FalseElseBook20.Visible = TrueEnd 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 MidoTuesday, 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 MidoFriday, 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 MidoMonday, 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
CorThursday, May 28, 2009 5:00 PM -
Hay,
Could any 1 be able to help me add this to my tabbed web browser in VB2008Sunday, 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 thebutton . 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 outFriday, 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,cwarcarblue11Thursday, 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 MidoSunday, 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 LucasThursday, 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 advanceWednesday, 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 advanceWednesday, 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