C# combobox select new item
Is it possible to set the selec开发者_如何学Goted item of a combobox to be an object that is not in its dropdown list?
If yes, then what must one do?
Use the Text
property:
comboBox.Text = "I'm not in the list!";
If you want to add the item to the list, use the Items
collection:
comboBox.Items.Add("I was added to the list!");
Is there a reason you cannot add it to the list after the object was generated? Is the object generated asynchronously?
myComboBox.Items.Add(newItem);
精彩评论