Autor Beitrag
Cool-Fux
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Sa 07.04.07 02:26 
Hallo,
ich möchte meine StringGrid mit den Dialog "Speichern unter" sichern und mit den Dialog
"Datei Öffnen" wieder laden.

Ich bekomme die Dialoge nicht in meinen Code.

Bitte um Hilfe!

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
procedure TForm1.ButtonSpeichernClick(Sender: TObject);
  var
  f : TStringList;
  i : Integer;
begin
  F := TStringList.Create;
  try
    f.Add(IntToStr(StringGrid1.RowCount));
    f.Add(IntToStr(StringGrid1.ColCount));
    for i := 0 to (StringGrid1.RowCount - 1) do
      f.Add(StringGrid1.Rows[i].CommaText);
      f.SaveToFile(ExtractFilePath(ParamStr( 0 )) + 'listen\'+'.txt');
  finally
    f.Free;
  end;
end;

procedure TForm1.ButtonLadenClick(Sender: TObject);
 var
  F: TStringList;
  i: Integer;
begin
  F := TStringList.Create;
  try
    F.LoadFromFile(ExtractFilePath(ParamStr( 0 )) + 'liten\.txt');
    StringGrid1.RowCount := StrToInt(F[0]);
    StringGrid1.ColCount := StrToInt(F[1]);
    for i := 0 to (StringGrid1.RowCount - 1) do
      StringGrid1.Rows[i].CommaText := F[i + 2];
  finally
    F.Free;
  end;
end;


Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 07.04.07 07:53 
Das passiert wenn man sich nicht mit dem Code auseinandersetzt.
Damit solltest Du allein drauf kommen. :wink:
ausblenden Delphi-Quelltext
1:
2:
3:
if OpenDialog1.Execute then
// Mach irgendwas
...SaveToFile(OpenDialog1.FileName);

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Cool-Fux Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Di 10.04.07 18:07 
Danke!