- 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 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Aymen Liga
am 6 Jun. 2019
Kommentiert: Geoff Hayes
am 10 Jun. 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 Kommentare
Akzeptierte Antwort
Geoff Hayes
am 9 Jun. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!