Autor Beitrag
steve-allround
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59

Linux, Windows

BeitragVerfasst: Sa 05.11.05 15:09 
Hy... kann mir jemand helfen?

Also ich habe in meinem Formular 2 Edit's...
Nun habe ich ein Save-Dialog mit dem Filter *.prof ...
Denn: Ich möchte nun die 2 Werte abspeicher, der User soll sich also aussuchen können, wohin er es speicher kann. Nun wie kann ich aber die Edits abspeichern?

Ich habe es die ganze Zeit ausprobiert, klappt aber irgendwie net...

Und ich brauch dies leider auch andersrum. Habe dazu Opendialog.

HHHHHHIIIIILLLLFFFFEEEE??????
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Sa 05.11.05 15:12 
Die Save- und der Opendialogs bieten dir nur die Oberfläche und geben dir ausschließlich die gewählten Dateinamen zurück. Um das Speichern in eine Datei musst du dich selbst kümmern.
Schau dir dazu einfach mal FILE, TEXTFILE und/oder TFILESTREAM an.

Alstar
steve-allround Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59

Linux, Windows

BeitragVerfasst: Sa 05.11.05 15:16 
Jo,
dachte ich mir schon irgendwie...
habe diesen Code schon zum speichern. Aber ebend nur, mit einem festgelegten Pfad und Dateiname. Wie kann ich hier die Werte von SaveDialog1 einsetzen?
mit SaveDialog1.FileName?

Hier der Code...
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
var
  sExePath: string;
   F: TextFile;
begin
{speichern}
sExePath := ExtractFilePath(Application.ExeName);
{1}
  AssignFile(F,sExePath + 'settings/1/00101.dll');
  Rewrite(F);
  WriteLn(F, Edit1.Text);  {Basala}
  WriteLn(F, Edit2.Text);  {Basalrate}
  CloseFile(F);
end;


????????

Moderiert von user profile iconGausi: Delphi-Tags hinzugefügt.
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Sa 05.11.05 15:21 
Die Delphi hilfe würde in diesem Falle folgendes schreiben:
Delphi Hilfe - OpenDialog hat folgendes geschrieben:

The FileName property returns the name and complete directory path of the most recently selected file. The value of FileName is the same as the first item in the Files property.


Alstar
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 05.11.05 15:24 
Eine meiner favourisierten Lernmethoden ist "Try and Error".

Da du schon eine mögliche Lösung angeboten hast: Probier sie doch einfach mal aus...mehr als ne formatierte Festplatte kann dir nicht passieren... :lol:

_________________
We are, we were and will not be.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 05.11.05 15:32 
Ist doch so fern und doch so nah..., um mal eine Deutsche Band zu zitieren.
Die Lösung hast Du selbst geschrieben, falls Ich hier nicht ganz falsch liege - SaveDialog.FileName.
steve-allround Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59

Linux, Windows

BeitragVerfasst: Sa 05.11.05 15:50 
Wow... Ja, ihr habt recht...
das ist ja so einfach, dass hätte ich nie gedacht....
:oops:

Hier nun der Code....
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var
  F: TextFile;
  begin
    if SaveDialog1.Execute then
  begin
  AssignFile(F,SaveDialog1.FileName);
  Rewrite(F);
  WriteLn(F, Edit1.Text);  {Basala}
  WriteLn(F, Edit2.Text);  {Basalrate}
  CloseFile(F);
  end;
  end;


Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Sa 05.11.05 15:52 
Jo. Und wenn Du jetzt noch von alleine die Code-Tags hinzufügst, ist das nahezu großartig :wink:

Alstar
steve-allround Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59

Linux, Windows

BeitragVerfasst: Sa 05.11.05 16:05 
Was sind Code-Tags?
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Sa 05.11.05 16:07 
Das was user profile iconraziel deinem Post freundlicher Weise hinzugefügt/ergänzt hat :wink:

Alstar
steve-allround Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59

Linux, Windows

BeitragVerfasst: Sa 05.11.05 16:28 
aha, na dann vielen Dank.....