Autor Beitrag
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 09.08.03 15:39 
Hi,
gibts eine einfachere Möglichkeit ein edit zu speichern als diese:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.Button1Click(Sender: TObject);
var
  F: TextFile;
begin
  AssignFile(F,'C:\Edit.txt');
  {$I-}
    ReWrite(F);
  {$I+}
  try
    if IOResult=0 then
      WriteLn(F, Edit1.Text);
  finally
    CloseFile(F);
  end;
end;


Greetz
TimonWorld
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 397



BeitragVerfasst: Sa 09.08.03 16:55 
Titel: Versuch es doch mit nem Memo *zusätzlich*
Mit Memo kein Problem!

:!: Um zu speichern:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
begin
Memo1.Clear; //Falls Memo1 noch Text enthält
Memo1.Lines.Add(edit1.text);
Memo1.lines.SaveToFile('C:\Text aus Edit1.txt');
end;


:D Willst du auch noch eine Datei ins Edit laden?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
begin
Memo1.Lines.LoadFormFile('C:\Text aus Edit1.txt');
Edit1.Text:=Memo1.Lines.GetText;
end;


Bin zwar erst 13 kenn mich trotzdem prima aus!
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 09.08.03 18:13 
Hi,
das wäre zwar auch eine Möglichkeit, aber etwas viel auffand. Denn ich möchte 30 edits in 30 dateien speichern. udn auch wieder laden. Trotzdem danke für deine Antwort.

[quote:4187d5fdcf="
TimonWorld"]Bin zwar erst 13 kenn mich trotzdem prima aus![/quote:4187d5fdcf]

Das glaube ich gerne, Ich bin 14 :-)

Greetz
majolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Sa 09.08.03 23:49 
Ich hoffe ich habs richtig verstanden und komme nicht mit einer ganz blöden lösung. Aber warum setzt du das ganze nicht in eine for-Schleife?? :lol:

_________________
Gruß
majolo
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 10.08.03 01:11 
Wieso eien for-Schleife für eine zeile?

@onlinehome: Ist doch in Ordnung deien Lösung.
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 10.08.03 11:13 
Luckie hat folgendes geschrieben:
Wieso eien for-Schleife für eine zeile?

@onlinehome: Ist doch in Ordnung deien Lösung.


Ja, aber es ist viel Code und ich möchte nicht 30 mal nach einander den Code schreiben.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 10.08.03 11:33 
onlinehome hat folgendes geschrieben:

Ja, aber es ist viel Code und ich möchte nicht 30 mal nach einander den Code schreiben.

Schon mal was von Funktionen oder Prozeduren gehört? :shock:
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 10.08.03 13:02 
Luckie hat folgendes geschrieben:
onlinehome hat folgendes geschrieben:

Ja, aber es ist viel Code und ich möchte nicht 30 mal nach einander den Code schreiben.

Schon mal was von Funktionen oder Prozeduren gehört? :shock:


???? Meinst du

ausblenden Delphi-Quelltext
1:
2:
3:
4:
function blabla....
begin
....
end;
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 10.08.03 13:05 
Wenn du keinen Rückgabewert brauchst würde ich eine Prozedur nehmen. Der üergibst du den Dateinamen und den Text.
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 10.08.03 13:12 
Und wie könnte das aussehen? Bitte komplette Source, thx.

Greetz
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 10.08.03 13:35 
Wie komplett?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure SaveEditToFile(Filename, EdtText: String);
begin
  { hier dein Code aus der ButtonClick Prozedur }
end;

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject); 
begin
  SaveEditToFile('c:\test.txt', Edit1.Text);
end;
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 10.08.03 14:57 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure SaveEditToFile(Filename, EdtText: String);
var
  F: TextFile;
begin
  AssignFile(F,'C:\Edit.txt');
  {$I-}
    ReWrite(F);
  {$I+}
  try
    if IOResult=0 then
      WriteLn(F, Edit1.Text);
  finally
    CloseFile(F);
  end;
end;

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject); 
begin
  SaveEditToFile('c:\test.txt', Edit1.Text);
end;


Aber da is ja dann im oberen schon der Dateiname bestimmt. Wie muss ich das ändern?
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 10.08.03 15:01 
Was glaubst du wohl, wozu die Parameter meiner Prozedur gut sind? :shock: Eventuell, um sie in der Prozedur zu benutzen? :roll:
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 10.08.03 15:31 
Jetzt richtig?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure SaveEditToFile(Filename, EdtText: String);
var
  F: TextFile;
begin
  AssignFile(F, Filename);
  {$I-}
    ReWrite(F);
  {$I+}
  try
    if IOResult=0 then
      WriteLn(F, EdtText);
  finally
    CloseFile(F);
  end;
end;

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject); 
begin
  SaveEditToFile('c:\test.txt', Edit1.Text);
end;
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 10.08.03 15:33 
Wie wäre es mit probieren?
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 10.08.03 15:38 
Es geht, DANKE.