Autor Beitrag
Salvador
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: Do 06.02.03 10:50 
Hallo,

Hat jemand ne Möglichkeit wie ich die Einträge einer Listbox in ein Memo schreiben kann? also alles was in der listbox aufgelistet wird, soll im memo aufgelistet werden.
thx
Salvador
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Do 06.02.03 11:02 
Hi!

Du wählst einfach in einer Schleife jedes Element in der Listbox aus und fügst es dem Memo hinzu:

ausblenden Quelltext
1:
2:
for i:=0 to Listbox.Items.Count-1 do
  Memo.Lines.Add(ListBox.Items[i]);


Cu,
Udontknow
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Do 06.02.03 11:29 
Hallo,

oder so:

ausblenden Quelltext
1:
2:
3:
4:
5:
  Memo1.Lines.Assign(ListBox1.Items);

  oder

  Memo1.Lines.AddStrings(ListBox1.Items)

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Do 06.02.03 11:32 
Stimmt, ist sogar noch schöner! :)
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Do 06.02.03 12:09 
ausblenden Quelltext
1:
Memo1.Lines := ComboBox1.Items;					

_________________
Ha! Es compiliert! Wir können ausliefern!
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Do 06.02.03 12:15 
Hmmm, das würde ich persönlich so nicht schreiben. Es ist zwar korrekt, da die Zuweisung der Eigenschaft eben über die Prozedur Setlines unten drunter Assign aufruft, erweckt aber sehr leicht den Anschein, als würde dieses dann auch für normale TStringlist-Instanzen gelten in der Form
MeineStringliste1:=MeineStringliste1;was ja aber eben nicht der Fall ist, hier kopiert man ja Zeiger.

Cu,
Udontknow