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?
Printable View
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?
Really broad question..
Do you have experience saving and loadings things to and from an external file, respectively?
you could save the information in a my.settings stringcollection
No, I don't is it hard?Quote:
Really broad question..
Do you have experience saving and loadings things to and from an external file, respectively
Not sure how to do that..Quote:
you could save the information in a my.settings stringcollection
look in Project-->Properties-->Settings tab
oh, I see. Any idea how I adjust it to do what I want it to?
in Project-->Properties-->Settings tab, change name to history, change type to stringcollection. you use a stringcollection like this:
vb Code:
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If My.Settings.history Is Nothing Then My.Settings.history = New Specialized.StringCollection My.Settings.history.Add("one") My.Settings.history.Add("two") My.Settings.history.Add("three") My.Settings.Save() End If Dim msg As String = "" For Each history As String In My.Settings.history msg &= history & vbCrLf Next MsgBox(msg) End Sub End Class
Thank you very much, I gave you a good rate for it.
yeah, and how do I connect the strings to the combobox?
MsgBox(My.Settings.history(combobox1.selectedindex))
I get an error on theit says index out of range, in needs to be not-negative and smaller then the size of your collection.Code:MsgBox(My.Settings.history(ComboBox1.SelectedIndex))
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
I tried it all, it won't work..
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:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If My.Settings.history Is Nothing Then My.Settings.history = New Specialized.StringCollection My.Settings.history.Add("http://www.google.co.uk/search?hl=en&q=stringcollection+vb.net&btnG=Google+Search&meta=" & "," & "google search 'stringcollection'") My.Settings.history.Add("http://www.devasp.net/net/articles/display/233.html" & "," & "working with stringcollection") My.Settings.history.Add("http://www.dotnet247.com/247reference/System/Collections/Specialized/StringCollection.aspx" & "," & "System.Collections.Specialized.StringCollection Class") My.Settings.Save() End If For Each history As String In My.Settings.history Dim strArray() As String = history.Split(",") ListBox1.Items.Add(strArray(1)) Next End Sub
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.