PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → arraydelete
arraydelete
Débuté par Garry Allen, 23 jan. 2018 00:05 - 2 réponses
Posté le 23 janvier 2018 - 00:05
This must be a dumb question but I can't seem to find anything in the help.
I have a browsed array of structures, say 10 of them and the user has selected the 6th element and wants to delete it by pressing a Delete button. What is the syntax for the button?
ArrayDelete(garrItems,CurrentElement) does not work.
Posté le 23 janvier 2018 - 00:36
I do it the next way, if the user selects it from a combobox I store in the glink of my combobox something useful to retrieve like the ID, so I do the following:

nSubscript is int = ArraySeek(arrMyArray,aslinearfirst,"IDFieldArray",COMBO_ID..StoredValue)
IF nSubscript <> -1 THEN
ArrayDelete(arrMyArray,nSubscript)
END

This code searches de ID stored in my combo in the Structure element where the ID is stored (I wrote it as IDFieldArray) and if it founds the ID selected from the combo in the array it deletes that array element.
Posté le 24 janvier 2018 - 17:24
Thanks for the suggestion. This was my first attempt at browsing an array and I solved the problem by using a memory table instead.