- create a callback for your delete button
- in the callback body, get the index/value of the selected item in the list (using the list box handle or object)
- using the cell array of list items (the record ids?) and the selected index, get the selected item
- remove the selected item from your cell array and update the list box with this modified cell array
- create the SQL statement to delete the record from your database
- execute the SQL statement
how to select a variable in listbox then click on the delete button and this variable disappears from the listbox and database
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Aymen Liga
il 6 Giu 2019
Commentato: Geoff Hayes
il 10 Giu 2019
hi
my problem is, I want to delete some data in the database that this data contains in the Access file, I want to delete it from the GUI
I want to select this variable in list box then click on the deleted button this variable disappears from the list and the database !
The second problem in listbox is not displaying all characters, but displaying only 6 characters
0 Commenti
Risposta accettata
Geoff Hayes
il 9 Giu 2019
Aymen - you haven't indicated how you are creating your GUI (using GUIDE, programmatically, or with App Designer) so the general idea would be to do the following:
As for the numbers (record ids) being formatted inconsistently, you will need to show the code you are using to update the list items. (You are probably doing a conversion from integer to a string or something like that). If using num2str you may want to set the format as shown at formatSpec — Format of output fields.
4 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!