Autor Beitrag
Heiming
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 31

WIN XP
D7 EE
BeitragVerfasst: Di 02.09.03 17:08 
wie ist es möglich den namen des ausgewählten items aus eine listbox rauzubekommen?

mit
ausblenden Delphi-Quelltext
1:
Listbox1.itemindex[0].name					

geht es nicht

_________________
Nur weil du nicht paranoid bist, heißt das nicht dass sie nicht hinter dir her sind !
Terra23
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Di 02.09.03 17:17 
ausblenden Delphi-Quelltext
1:
ListBox1.Items[ListBox1.ItemIndex];					

_________________
Hasta La Victoria Siempre
Heiming Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 31

WIN XP
D7 EE
BeitragVerfasst: Di 02.09.03 18:07 
Terra23 hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
ListBox1.Items[ListBox1.ItemIndex];					


das liefert den namen?
wie kann ich dann den namen von dem item mit der nummer 1 bekommen? :?:

_________________
Nur weil du nicht paranoid bist, heißt das nicht dass sie nicht hinter dir her sind !
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Di 02.09.03 18:12 
Die Items haben keinen Namen, nur den Text, der in der ListBox steht und den bekommst Du für ein Item mit
ausblenden Delphi-Quelltext
1:
ListBox1.Items[index];					

wobei Index ein Integer ist und die Zeile soz. angibt (von 0 startend)
ItemIndex gibt das gerade markierte Element an, also gibt den Index zurück. So hat es Terra dann auch gezeigt.
Terra23
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Di 02.09.03 18:35 
... und wenn du das erste Element haben mußt, nimmst du

ausblenden Delphi-Quelltext
1:
ListBox1.Items[0]					


weil die ListBox mit dem Index 0 startet, wie UGrohne dir mitgeteilt hat..

_________________
Hasta La Victoria Siempre