|
I have two forms, the first has a ListBox that is binding to a datasource. When an item is selected, the second form populates it's details. The problem I'm having is that when I delete an item from the ListBox, the second form does not update despite having SelectedIndexChanged handler that explicitly calls update on the second form.
I think the problem arises from the way I handle the delete. I run SQL delete query for the dataset to perform the delete and then I call Fill to update the ListBox. The Fill seems to set the selected index to -1. Obviously I check that before i update (I can't update for -1). When the delete and the SelectedIndexChanged handler run through I end up with an item being selected, but the second form still shows the details of the deleted item. Further I do not get a second SelectedIndexChanged event.
Any ideas how to fix that? I use the same approach in 4 different pair of forms and it makes look my app buggy. Thanks !
|