My listbox doesn’t refresh correctly after I delete a row and I don’t know why. In my delete even I call listbox.RemoveAllRows the reload the listbox but the deleted row is still there. The record in the database is deleted. I’ve tried listbox.Refresh yet it’s the same. When I refresh the window the listbox displays correctly, but I shouldn’t have to do that. I’ve used my listbox code snippet with other apps with no problem. I’d appreciate any insight to resolve this issue.
Have you determined whether it’s a visual display glitch, or if the data is actually still in the listbox?
A number of things could be going on, but there just aren’t enough pieces here to help you out.
Do you have an example project that shows this behavior?
[quote]the reload the listbox but the deleted row is still there. …
When I refresh the window the listbox displays correctly,[/quote]
That suggests that ‘reload the listbox’ and ‘refresh the window’ may not be using the same ‘populate the listbox’ code.
Maybe they read different databases - ( the forum is full of reports from people who say ’ I did this in my database and nothing changed’, followed a few hours later by ‘oh, it was the wrong database’)
Why not add some debugging code so that you get a listbox row count and a database record count at all points?
My listbox doesn’t refresh correctly after I delete a row
Where the deleted Row resides: in the ListBox / in the DataBase ?
I call listbox.RemoveAllRows
Please, start by writing the code logic steps, then write the Xojo Code and in the end, run it.
Example of logic:
- Delete a Row [in the ListBox and in the Data Base]
- Clears the Listbox contents *
- Load the Data Base contents back in the ListBox *
Then, you will understand where there is a problem and modify your logic.
- I do not understand why.
I originally had had the event within a yes/no message box, and when I removed it from that it worked just fine. For a test I tried it again within the MB and had same problem. I don’t understand why the MB would cause that to happen.
Thank you all for your support.