How do I make a ListBox refresh its item text?

I use this class when I need to have a list box that updates.

Update the object in the list and then call either of the included methods, depending on if you have the index available or not. If you are updating an object that is contained in the list, but you don’t have the index, you will have to call RefreshItems and update all of the items.

public class RefreshingListBox : ListBox
{
    public new void RefreshItem(int index)
    {
        base.RefreshItem(index);
    }

    public new void RefreshItems()
    {
        base.RefreshItems();
    }
}

Leave a Comment