Rebinding a control in Windows Forms

  • Thread starter Thread starter George Jordanov Ivanov
  • Start date Start date
G

George Jordanov Ivanov

Hi folks,

I have the following problem. I have a nice-and-tidy ListBox control, which
is bound to another nice-and-tidy strongly typed collection.

But when the collection changes (for example I have added a new item to it
from another location), I want to notify the control to re-bind to its
up-to-date data. How can I do this in Windows Forms?

Thanks in advance.
Regards,
George Jordanov Ivanov

To note, there is such method named DataBind() in ASP.NET for each Web-based
control.
 
Hi,

1. if you know when the collection changes (by event or smth) you can set
ListBox.datasource = null, then set it again to collection
 
Hi Daniel,

I tried this approach but I find it more like "hack" instead of clear fix of
the problem. Just for the test, try to have more items in the list box (like
10000 for instance) and you will see a terrible blinking on the UI (cased by
the clearing up and then populating the whole list box again).

Thanks for the suggestion, though.
Regards,
George Jordanov Ivanov
 
Back
Top