ListBox has set datasource but Refresh does nothing ListBox has set datasource but Refresh does nothing database database

ListBox has set datasource but Refresh does nothing


It'll only refresh when objects have changed (ex. a different query), not the data. You can do this:

listBoxDays.DataSource = null;listBoxDays.DataSource = DBQuery.informationRetreval().DefaultView;

to refresh it... everytime you need to.


Refresh(): Forces the control to invalidate its client area and immediately redraw itself and any child controls.

Refresh will not rebind your control, it will just cause the control to be redrawn. You will have to set the DataSource again with

listBoxDays.DataSource = DBQuery.informationRetreval().DefaultView;

and re-bind it.

Source: Microsoft MSDN