[Help] VB.NET 2008 - Saving ListBox Items in Settings

Posts 1–13 of 13 · Page 1 of 1
[Help] VB.NET 2008 - Saving ListBox Items in Settings
I've set up everything, and on the Settings tab in the Project Properties I've set up some items, and I want to save the items in my ListBox so that on the next load it loads them up. I'm doing this through the Settings on Project Properties. However it denies it, saying:
Value of type 'System.Windows.Forms.ListBox.ObjectCollection' cannot be converted to 'System.Collections.Specialized.StringCollection'.
Any help on this???
Try the split function.
there are enough tutorials about this. use the searchfunction.
Rules: Display Error
Display Code
Display Code line before
Display Code Line after
Display the code you are using (preferably in it's entirety)

That is going to be the best way we can help you
I do not think it is possible to save a listbox contents to my.settings i posted a TUT on saving listbox items to a text file, you can look it up under nextgens tut list
Code:
my.settings.blablabla.clear()
for each item in listbox1
my.settings.blablabla.add(item)
next


*note, "blablabla" should be changed to the name of the setting.
/pwnt the minion

also, make sure you add at least one item and then delete it in the setting, or else it will not work.
Quote Originally Posted by mnpeepno2 View Post
Code:
my.settings.blablabla.clear()
for each item in listbox1
my.settings.blablabla.add(item)
next


*note, "blablabla" should be changed to the name of the setting.
/pwnt the minion

also, make sure you add at least one item and then delete it in the setting, or else it will not work.
Have you tested that method? I don't think that that method works
works in the web browser im building, and im 99% finished, just need to add a msgbox.

EDIT: Finished it...
lmao thats how badly i must suck... i always tried to save it as a string (never quite worked...)

but hey, im learning
/pwnt the minion
ha ha , You wish,

His question was easy to understand and straight forward. My concern is getting those into the habit of using the rules, the specific rules I listed above are there to better help the one asking the question, it will allow those answering the questions to better help them, and even faster.

The ListBox item contents are stored in ListBox.ObjectCollection, whenever you use the Items.Add method, you need to use ToString method or CType to convert the connection object to string.

I don't know if your method would work, but if you say it does, i'm sure it will.

the OP will let us know.
w8, so u want me to release the web browser?
Who said that? ...
Posts 1–13 of 13 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us