Autor Beitrag
Maniacmd
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 94

Windows XP
Delphi 7 Personal
BeitragVerfasst: Sa 22.04.06 12:03 
wie es schon in der überschrift steht wie kann ich den inhalt eines label in ein memo feld reischreiben lassen? hab in der suche nichts passendes gefunden


Moderiert von user profile iconGausi: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Sa 22.04.2006 um 13:07
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Sa 22.04.06 12:04 
Memo1.Lines.Add(Label1.Caption);

oder Memo1.Lines.Text := Label1.Caption; ;)

greetz

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
Maniacmd Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 94

Windows XP
Delphi 7 Personal
BeitragVerfasst: Sa 22.04.06 12:09 
ok und umgekehrt?
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 22.04.06 12:12 
ausblenden Delphi-Quelltext
1:
2:
Label1.Caption := Memo1.Text;
Label1.Caption := Memo1.Lines[X];  // X = Linie, beginnend bei 0

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Maniacmd Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 94

Windows XP
Delphi 7 Personal
BeitragVerfasst: Sa 22.04.06 12:16 
ok danke
Maniacmd Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 94

Windows XP
Delphi 7 Personal
BeitragVerfasst: Sa 22.04.06 12:35 
ich habe jetzt ein weiteres problem bei laden aus einer txt datei hier ist der code für den laden button
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Laden1Click(Sender: TObject);
begin
timer1.Enabled:=false;
timer2.enabled:=true;
Memo1.Lines.LoadFromFile('C:\windows\score.txt');
Labelguthaben.Caption := Memo1.Text;
Labelguthaben.Caption := Memo1.Lines[1];
end;

und dann soll der inhalt des memos = der inhalt des labels sein aber im label steht dann immer '' also es ist leer.
hier ist noch der code für den timer der die beiden inhalte gleichsetzt
ausblenden Delphi-Quelltext
1:
2:
memo1.Lines.Clear;
memo1.Lines.add(labelguthaben.Caption);
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Sa 22.04.06 12:42 
user profile iconManiacmd hat folgendes geschrieben:
ich habe jetzt ein weiteres problem bei laden aus einer txt datei hier ist der code für den laden button
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Laden1Click(Sender: TObject);
begin
timer1.Enabled:=false;
timer2.enabled:=true;
Memo1.Lines.LoadFromFile('C:\windows\score.txt');
Labelguthaben.Caption := Memo1.Text;
Labelguthaben.Caption := Memo1.Lines[1];

end;

und dann soll der inhalt des memos = der inhalt des labels sein aber im label steht dann immer '' also es ist leer.
hier ist noch der code für den timer der die beiden inhalte gleichsetzt
ausblenden Delphi-Quelltext
1:
2:
memo1.Lines.Clear; // lass die 2 zeilen einfach ganz weg
memo1.Lines.add(labelguthaben.Caption);


Also du lädst ja schon in das Memo, und dann weißt du dem Text dem Label zu und dann wieder dem Memo? Warum? Das was ich gehighlighted hab gibt keinen sinn, weil die Caption des Memos dann immer das 2. annimmt.. Lines[1] ist die 2. Zeile (ist das vllt. dein Fehler? )


EDIT:
ausblenden Delphi-Quelltext
1:
2:
3:
// Lade score.txt
  Memo1.Text := Memo1.Lines[0];
  Label.Caption := Memo1.Lines[0]; // oder 1..



greetz

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.


Zuletzt bearbeitet von Born-to-Frag am Sa 22.04.06 12:43, insgesamt 1-mal bearbeitet
Waldteufel
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 22.04.06 12:42 
Hi ManiacMD.

Du sollst ja auch nicht beide Befehle verwenden, sondern dir einen aussuchen. ;-)

Labelguthaben.Caption := Memo1.Text; schreibt den gesamten Text ins Label,
Labelguthaben.Caption := Memo1.Lines[1]; aber nur die zweite Zeile.
Maniacmd Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 94

Windows XP
Delphi 7 Personal
BeitragVerfasst: Sa 22.04.06 12:45 
ich habe aus der 1 bei memo lines einfach eine 0 gemacht jetzt gehts danke
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Sa 22.04.06 12:47 
user profile iconManiacmd hat folgendes geschrieben:
ich habe aus der 1 bei memo lines einfach eine 0 gemacht jetzt gehts danke
Sag ich doch :D

Und trotzdem sind da noch unnötige Zeilen drin weil du Den Text des Memos dem Label zuweist, danach weißt du die erste Zeile dem Label zu und danach weist du dem Memo die Caption des Labels zu :roll:


greetz

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.