Valter

Valter

  • NA
  • 3
  • 0

Updating combobox if the ToString() result of an item changes

Jun 6 2010 9:38 AM
Hello,
I've got a simple question related to combobox. Consider that a combobox is populated with the instances of the following example class:
class Plot
{
private string label;

public string Label
{
get { return label; }
set { label = value; }
}

public override string ToString()
{
return label;
}
}

Now consider that one of these objects will be assigned a different label somewhere else in the program. How can I notify the combobox that it should call the ToString() method of this item again to update its list accordingly? I hope there exists some intelligent mechanism, I'd like to avoid just manually repopulating the combobox each time an item label is changed.

Answers (1)