Autor Beitrag
Borlox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Fr 13.09.02 17:26 
Hi Leute,

ich habe eine Listbox und möchte, wenn ich einen Eintrag davon ausgewählt habe und einen Button drücke, dass dieser Eintrag aus der Liste gelöscht wird und einer anderen hinzugefügt wird, wie kann ich das am besten machen?

THX
Borlox
aogwaba
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 109



BeitragVerfasst: Fr 13.09.02 17:48 
Hi!
TListbox.ItemIndex ist ein Read/Write Property, welches die Position des aktuellen (selectieren) Item darstellt.
Mit TListbox.item[x] kann man auf die einzelnen Items zugreifen (read/write).

cu
waba
Borlox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Fr 13.09.02 18:00 
Titel: Löschen
Und wie kann ich dann diesen Eintrag damit löschen?
THX
Borlox
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Fr 13.09.02 18:04 
hi,

das kannste einmal mit

ListBox1.DeleteSelected; (erklärungen sind wohl überflüssig :mrgreen: ) oder mit ListBox1.Items.Delete(Index); machen.

So, hoffentlich habe ich dir geholfen.

_________________
Viele Grüße
Jakob
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Fr 13.09.02 21:44 
Merke Dir aber vor dem löschen des Items den aktuellen Index (Property ItemIndex) damit Du nacher weißt an welcher Position Du das neue Items (mit der Methode Insert) einfügen musst.

Gruß
TINO