dimanche 28 décembre 2014

How to remove previous items from ListBox, and add only the new ones?

I have a C# project using SQLite in Visual Studio that inserts some data in a ListBox through data binding. The problem is that if the table is changed and then the Page is loaded, the old values are still present i.e. I get old results and the new ones are appended.


How do remove the old values so that everytime I modify my selection I get only the new values?



List <NTable> l1 = dbConn.Query<NTable>("select * from NTable");
list1.ItemsSource = l1;


Next time when the page loads, list1 should be empty so that only the retrieved rows can be displayed. Here retrieved rows along with previously retrieved rows, both are displayed on loading the page.


Aucun commentaire:

Enregistrer un commentaire