- 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 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Aymen Liga
el 6 de Jun. de 2019
Comentada: Geoff Hayes
el 10 de Jun. de 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 comentarios
Respuesta aceptada
Geoff Hayes
el 9 de Jun. de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!