Question How to update the ListView after the deletion of ListViewItem on it?


Active member
Mar 6, 2019
Programming Experience
1)I have ListView control on Form
2)will populate the control with data with help of database.
  1. I have a delete button, if the delete button is pressed I will delete the selected item of the control in the database.
  2. I did use ListView.refresh() but the ListView did not update after the deletion. please help me
I did use the following code, But it did not work:
listViewArenaInfo.Clear();// clears the ListView.
PopulateListView();// gets the data for the ListView.
Why would you expect the Refresh method to help here? The ListView knows nothing about your database. Why should it do anything as a result of your deleting a record in the database? The ListView only knows about the items you added to it. If you want one of those items to be removed, you have to remove it. Given that you used an Add method to add the items in the first place, would it surprise you to learn that you remove an item with a Remove method?

That said, you almost certainly shouldn't be using a ListView in the first place. You should use a data adapter to populate a DataTable and then bind that to a DataGridView via a BindingSource. You would then delete a row in the DataTable first, by calling an appropriate method on the BindingSource, e.g. RemoveCurrent - or the user can just select a row and press the Delete key - and then you save that and all other changes from the DataTable to the database using the same data adapter.
Top Bottom