Web Browser History and Favourites
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
9 posts
Page 1 of 1
Hi there all i need help in making a web browser history and favourites as the title says ^^
By the way i m using a Tab Control and i used the ctype code thign in the tabbed browser so i really need ur help making tabbed browser history and favourites
I believe i saw a tutorial if i used a web browser control but im out of luck becuz i m using a tabbed web browser so please help me if u can
TY and regards,
Robby1998
By the way i m using a Tab Control and i used the ctype code thign in the tabbed browser so i really need ur help making tabbed browser history and favourites
I believe i saw a tutorial if i used a web browser control but im out of luck becuz i m using a tabbed web browser so please help me if u can
TY and regards,
Robby1998
Hello,
Im not sure what you mean by history, you could use "Forward and Back" buttons to goto previous pages youve visted. Or do you want to save every single page you visit like internet explorer does?.
If you want to store favourite websites you could do something like this, for this im using a combobox to store the favourites:
Add a ComboBox and Button control to your form and use the following code:
For the ComboBox_SelectedIndexChanged event use:
Hope thats the kindof thing you wanted, if not or you need anymore help please let me know cooll;
Im not sure what you mean by history, you could use "Forward and Back" buttons to goto previous pages youve visted. Or do you want to save every single page you visit like internet explorer does?.
If you want to store favourite websites you could do something like this, for this im using a combobox to store the favourites:
Add a ComboBox and Button control to your form and use the following code:
For the ComboBox_SelectedIndexChanged event use:
Code: Select all
And for the button_click event use this:CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ComboBox1.Text)
Code: Select all
Then inside your Form_load event use this:ComboBox1.Items.Add(CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString)
With ComboBox1
Dim i As Integer
Dim s As String = ""
For i = 0 To .Items.Count - 1
s += .Items(i).ToString & vbNewLine
Next
My.Computer.FileSystem.WriteAllText(Application.StartupPath & "\visurl.fav", s, False)
End With
Code: Select all
What this code does is if you click the button you just added (save to favourites) it stores the page into the combobox and saves it to a file. Then when you select a page in the combobox it will load it into the selected browser tab. Also when the form first loads it will load your saved favourites into the combobox. If My.Computer.FileSystem.FileExists(Application.StartupPath & "\visurl.fav") Then
Using sr As New IO.StreamReader(Application.StartupPath & "\visurl.fav")
Dim item As String = sr.ReadLine
While item <> Nothing
ComboBox1.Items.Add(item)
item = sr.ReadLine
End While
End Using
End If
Hope thats the kindof thing you wanted, if not or you need anymore help please let me know cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
hi
o ok thx but is it possible to put it in a menu strip or justa combobox becuz i have tried it in menu strip and i will try it in the combobox
About the history i mean like Internet Explorer does it just like that
It will just open up a panel so in there there would be most visited links
like that so it is useful if u close it and then start it again and yea please help if u can
Ty and regads,
Robby1998
o ok thx but is it possible to put it in a menu strip or justa combobox becuz i have tried it in menu strip and i will try it in the combobox
About the history i mean like Internet Explorer does it just like that
It will just open up a panel so in there there would be most visited links
like that so it is useful if u close it and then start it again and yea please help if u can
Ty and regads,
Robby1998
Hello,
OK to put favourites into a menustrip control I would do something like this. Add a menustrip to your form and make a menu item called "Favourites" then add the following code to your project.
Inside the Form_load event add:
Now if you want to keep a history of every page you visit you could add a ListBox control somewhere on your form, wherever you want the history to be displayed and then use this code in your project.
Add this to the Form_load event:
Happy coding! cooll;
OK to put favourites into a menustrip control I would do something like this. Add a menustrip to your form and make a menu item called "Favourites" then add the following code to your project.
Inside the Form_load event add:
Code: Select all
Then in the "Add to Favourites" button_click event add this:If My.Computer.FileSystem.FileExists(Application.StartupPath & "\visurl.fav") Then
Using sr As New IO.StreamReader(Application.StartupPath & "\visurl.fav")
Dim item As String = sr.ReadLine
While item <> Nothing
FavouritesToolStripMenuItem.DropDownItems.Add(item)
item = sr.ReadLine
End While
End Using
End If
Code: Select all
Then for the Favourite menu dropdownitem_click event use this: FavouritesToolStripMenuItem.DropDownItems.Add(CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString)
With MenuStrip1
Dim i As Integer
Dim s As String = ""
For i = 0 To FavouritesToolStripMenuItem.DropDownItems.Count - 1
s += FavouritesToolStripMenuItem.DropDownItems(i).ToString & vbNewLine
Next
My.Computer.FileSystem.WriteAllText(Application.StartupPath & "\visurl.fav", s, False)
End With
End Sub
Code: Select all
That code will Add/Save and Load your favourites for the browser. Private Sub FavouritesToolStripMenuItem_DropDownItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles FavouritesToolStripMenuItem.DropDownItemClicked
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(e.ClickedItem.Text.ToString)
End Sub
Now if you want to keep a history of every page you visit you could add a ListBox control somewhere on your form, wherever you want the history to be displayed and then use this code in your project.
Add this to the Form_load event:
Code: Select all
Add this into your tabpage browsers "DocumentCompleted" event:If My.Computer.FileSystem.FileExists(Application.StartupPath & "\history.nav") Then
Using sr As New IO.StreamReader(Application.StartupPath & "\history.nav")
Dim item As String = sr.ReadLine
While item <> Nothing
ListBox1.Items.Add(item)
item = sr.ReadLine
End While
End Using
End If
Code: Select all
Then add this code into the "ListBox_SelectedIndexChanged" event: ListBox1.Items.Add(CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString)
With ListBox1
Dim i As Integer
Dim s As String = ""
For i = 0 To .Items.Count - 1
s += .Items(i).ToString & vbNewLine
Next
My.Computer.FileSystem.WriteAllText(Application.StartupPath & "\history.nav", s, False)
End With
Code: Select all
That code will save every page you visit into the ListBox and Save/Load them with your browser.CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(CType(sender, ListBox).SelectedItem.ToString)
Happy coding! cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
hi there i have used the favourites one and it works perfectly and thx for that but as for the history one i cant find document completed for the tab control1 so please if you could help me or tell me what its real name is or how to get it at that point!
ty and regards,
Robby1998
ty and regards,
Robby1998
o and also i need help in how to make a homepage using a textbox and a button
P.S sorry for asking too many question i m a beginner to VB so i m bad at it right now and i dont know much stuff so srry
Robby1998
P.S sorry for asking too many question i m a beginner to VB so i m bad at it right now and i dont know much stuff so srry
Robby1998
Hello,
If your browser uses tabs are you not creating the browsers dynamically?. If your only using 1 webbrowser control then it would go into "Webbrowser_documentcompleted" event.
For storing the home page I think your best most effective option is to save it in a setting. If you click "Project > Application Propertise> Settings" in the top navigation menu on VB then enter this setting with the value:
homepage - Value = http://www.google.com (or whichever page you want to be homepage)
Then in your project you could just add a "Set as Homepage" button and use this code in its click event:
Happy coding! cooll;
If your browser uses tabs are you not creating the browsers dynamically?. If your only using 1 webbrowser control then it would go into "Webbrowser_documentcompleted" event.
For storing the home page I think your best most effective option is to save it in a setting. If you click "Project > Application Propertise> Settings" in the top navigation menu on VB then enter this setting with the value:
homepage - Value = http://www.google.com (or whichever page you want to be homepage)
Then in your project you could just add a "Set as Homepage" button and use this code in its click event:
Code: Select all
Or you could add a textbox for the user to enter the homepage URL and in your "Set as Homepage" button click event use this code instead:My.Settings.homepage = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString
My.Settings.Save()
Code: Select all
Then in the form_load event add this code at the top to load your homepage when the browser starts:My.Settings.homepage = TextBox??.Text ( The '??' needs replacing with the number of the textbox)
My.Settings.Save()
Code: Select all
And that should be it but it all depends on how your browser code is setup, If you send me the project files in a private message ill have a look at your code and see how best to add these features.CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(Convert.ToString(My.Settings.homepage))
Happy coding! cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Hello this is robby1998 here
ok i can send you my whole project but just to let you know my project is a big mess so yea i just have everrthing like all messed iin so it might be hard to look for stuff
if u ok wit that then i will send u the project
robby1998
ok i can send you my whole project but just to let you know my project is a big mess so yea i just have everrthing like all messed iin so it might be hard to look for stuff
if u ok wit that then i will send u the project
robby1998
ok and i got a problem wit the homepage code please try to fix if u can and the project i sent u
9 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023