Entwickler-Ecke

Grafische Benutzeroberflächen (VCL & FireMonkey) - ListBox-Eintrag ändern


Moritz M. - Mi 09.10.02 18:49
Titel: ListBox-Eintrag ändern
Hi Leute

Ich hab dazu gesucht aber nichts gefunden(vielleicht bin ich einfach zu dumm...) deshalb stell ich nun die Frage:

Wie kann ich einen Eintrag einer ListBox, wenn ich die Nummer mit listbox.Itemindex weiß, ändern bzw. ermitteln?

cu

onz


Tino - Mi 09.10.02 19:08

Einmal so:

Quelltext
1:
2:
3:
4:
If ListBox1.ItemIndex > -1 Then
  Str := ListBox1.Items [ListBox1.ItemIndex];
Else
  Str := '';

und zum ändern so:

Quelltext
1:
2:
If ListBox1.ItemIndex > -1 Then
  ListBox1.Items [ListBox1.ItemIndex] := 'AUQ.de!';

Gruß


Chatfix - Mi 09.10.02 19:10

also auslesen und ändern kannst du folgende eigenschaft:


Quelltext
1:
listbox1.Items.Strings[INDEX]:='Dein String';                    


Chatfix - Mi 09.10.02 19:11

wieder jmd schneller :evil:


Moritz M. - Mi 09.10.02 19:49
Titel: Hi
Müsst euch ja nicht zanken!

Danke an euch beide für eure Hilfe :D

cu

Onz