jkroupa Posted January 22, 2004 Posted January 22, 2004 using c#, I basically want the equivlent of a mfc ComboBox or ListBox where you can SetItemData() on an index. I want to store several variables for each entry in my combo box, but am unsure how to do it. I imagine I could override the item.add for a combobox, however I don't know how to do that. Any one got some ideas? Quote
Administrators PlausiblyDamp Posted January 22, 2004 Administrators Posted January 22, 2004 Easiest way is create a class to hold the items you want and override the tostring method to return what you would like displayed. The listbox.items.add() method takes any object and calls it's ToString method to get the text to display. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
jkroupa Posted January 22, 2004 Author Posted January 22, 2004 Sadly I posted before I looked, and I noticed a recent thread that said essentially the same thing. Now my question is, how do I create columns in a combo box? basically I want something like 123 | blah 134 | Super blah so that the Key is what is displayed, but dropping down you see the description. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.