Hi,
I have a dropdown list on a winform that has a list of computernames in it. As the user types new computer names into the dropdown box i'd like the program to then add this item to the dropdown for next time the program funs.
My first thought was this could be accomplished using the new application settings section of .net 2 but I could not see an easy way to do it.
Any ideas?
-
-
You can do this using settings. What you probably want is to use a setting of an array type, which you can do although I admit it's not very obvious how.
Open the Settings tab on your project properties, add a new setting called for instance ComputerNames. On the type dropdown, choose the bottom option "Browse...". On the dialog that opens, you can type in the Selected Type box. Type "System.String[]" (without the quotes), click OK. Now you have a setting that is an array of strings.
Put the computer names entered by the user into an array, assign the array to the setting and call Save() on the settings object, and they are stored. Next time, read out the array and add the values to the drop down.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.