Combobox ?

web4

Member
Joined
Mar 28, 2009
Messages
16
Programming Experience
Beginner
hi i would like to ask how to add items in combobox1 that will be saved....this pattern isn't do the way i want...Form2.ComboBox1.Items.Add("test") because after i close the form2 it would be back to nothing...is there a code that will do this? because it works only in design view...in items then collection...pls....help thanks
 
Of course it works in design view because you are changing the source code of your application. When you add items ad run time you are only changing the data stored in memory, not the application itself. As soon as you close the data in memory is flushed and it's gone. If you want to be able to add items and keep them then you have to save them somewhere yourself, like a database or the config file. One of the most common methods is to add a StringCollection to project Settings. That will be stored in the config file so you can simply update the collection and it will be saved automatically.
 
could you teach me the most common method.....adding a stringcollection to project settings...or could you give me some code...or could you give me some links? thanks...this is really helpful...and because this is helpful i add a reputation for you..:)
 
Do a search for "application settings in vb.net and Visual Studio" This should be a good starting point. Although I still prefer ini files.
 
Back
Top