I am looking to create a dropdown menu in my windows form application that is similar to the dropdown menu in html i.e. etc..
I need each entry to display text to user but store a value to be used in my app.
I am currently using a combobox but that doens’t seem to let me store an associated value for each entry.
Thanks in advance.
You can store anything in a combo box, up to and including an object instance that holds the value you need, plus the string. All you need to do is override
ToStringin the class you use as item.Then:
When you work with
comboBox1.Itemsall you need to do is cast the items toItemand you’re all set.