Results 1 to 15 of 15

Thread: History memory on WebBrowser

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Location
    England
    Posts
    270

    History memory on WebBrowser

    How do I make a combbox that remembers history in vb.NET

    How can I make a favourites menu strip that lets the explorer save favourite information to next time i open explorer?
    Last edited by fenhopi; Jan 14th, 2008 at 12:46 PM.

  2. #2
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: History memory on WebBrowser

    Really broad question..

    Do you have experience saving and loadings things to and from an external file, respectively?

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: History memory on WebBrowser

    you could save the information in a my.settings stringcollection

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Location
    England
    Posts
    270

    Re: History memory on WebBrowser

    Really broad question..

    Do you have experience saving and loadings things to and from an external file, respectively
    No, I don't is it hard?

    you could save the information in a my.settings stringcollection
    Not sure how to do that..

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: History memory on WebBrowser

    look in Project-->Properties-->Settings tab

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Location
    England
    Posts
    270

    Re: History memory on WebBrowser

    oh, I see. Any idea how I adjust it to do what I want it to?

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: History memory on WebBrowser

    in Project-->Properties-->Settings tab, change name to history, change type to stringcollection. you use a stringcollection like this:

    vb Code:
    1. Public Class Form1
    2.  
    3.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    4.         If My.Settings.history Is Nothing Then
    5.             My.Settings.history = New Specialized.StringCollection
    6.             My.Settings.history.Add("one")
    7.             My.Settings.history.Add("two")
    8.             My.Settings.history.Add("three")
    9.             My.Settings.Save()
    10.         End If
    11.         Dim msg As String = ""
    12.         For Each history As String In My.Settings.history
    13.              msg &= history & vbCrLf
    14.         Next
    15.         MsgBox(msg)
    16.     End Sub
    17.  
    18. End Class
    Last edited by .paul.; Jan 15th, 2008 at 06:33 PM.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Location
    England
    Posts
    270

    Re: History memory on WebBrowser

    Thank you very much, I gave you a good rate for it.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Location
    England
    Posts
    270

    Re: History memory on WebBrowser

    yeah, and how do I connect the strings to the combobox?

  10. #10
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: History memory on WebBrowser

    MsgBox(My.Settings.history(combobox1.selectedindex))

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Location
    England
    Posts
    270

    Re: History memory on WebBrowser

    I get an error on the
    Code:
     MsgBox(My.Settings.history(ComboBox1.SelectedIndex))
    it says index out of range, in needs to be not-negative and smaller then the size of your collection.

  12. #12
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: History memory on WebBrowser

    have you added all the items in the combobox to your history setting?
    or, is the combobox empty? i.e. selectedindex = -1

    when you load the program you should add all the history settings to the combobox

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Location
    England
    Posts
    270

    Re: History memory on WebBrowser

    I tried it all, it won't work..

  14. #14
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: History memory on WebBrowser

    heres a demonstration. it displays your history (descriptions) in the listbox. if you click an item in the listbox it'll display a msgbox withe the full URL + description as saved in my.settings.history

    see attachment

    vb.net Code:
    1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.     If My.Settings.history Is Nothing Then
    3.         My.Settings.history = New Specialized.StringCollection
    4.         My.Settings.history.Add("http://www.google.co.uk/search?hl=en&q=stringcollection+vb.net&btnG=Google+Search&meta=" & "," & "google search 'stringcollection'")
    5.         My.Settings.history.Add("http://www.devasp.net/net/articles/display/233.html" & "," & "working with stringcollection")
    6.         My.Settings.history.Add("http://www.dotnet247.com/247reference/System/Collections/Specialized/StringCollection.aspx" & "," & "System.Collections.Specialized.StringCollection Class")
    7.         My.Settings.Save()
    8.     End If
    9.     For Each history As String In My.Settings.history
    10.         Dim strArray() As String = history.Split(",")
    11.         ListBox1.Items.Add(strArray(1))
    12.     Next
    13. End Sub
    Attached Files Attached Files
    Last edited by .paul.; Jan 15th, 2008 at 06:40 PM.

  15. #15
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: History memory on WebBrowser

    I know this is a old post goodness....But i got a question about it lol.....I am using a multi tab browser and would instead like the items displayed into a list box on another form. At this point im getting into a tangled up mess of confusion lol any tips or could someone simplify for me? I think i finally understand it just dont know how to contstruct it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width