E
E
Eugene2015-10-05 12:17:13
C++ / C#
Eugene, 2015-10-05 12:17:13

Why does ListBox stop redrawing after changing DataSource?

There is a ListBox on the form, to which I assign DataSource and DisplayMember. When I assign for the first time, everything works well. After re-assigning another DataSource, the listBox stops redrawing and is displayed as empty.
Moreover, if you click on it with the mouse, you can see that SelectedIndexChanged is called and the objects I need are highlighted.
I use BindingList as DataSource

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Kovalsky, 2015-10-05
@dmitryKovalskiy

Are you just replacing the DataSource? don't call Bind()?

E
Eugene, 2015-10-05
@Onni

Yes, and who should call him?

A
Anton N., 2015-10-09
@NewOrdered

Use BindingSource. After updating the data source, call the ResetBindings(false) method.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question