Autor Beitrag
AlexBegin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: So 16.09.07 16:29 
Hallo alle zusammen,
ich möchte gern den Inhalt meiner dynamisch erzeugten Edit`s abspeichern. Bei den ??? im Source-Code liegt das Problem. Wenn ich dort MyEdit.Text angebe, wird kein Text abgespeichert.

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:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
procedure TForm8.FormShow(Sender: TObject);


var
AnzahlEintraege: Byte;
MyTop: Integer;
MyLabel: TLabel;
MyEdit: TEdit;

begin
  Form7.Close;
  MyTop := 55;
  for AnzahlEintraege := 1 to StrToInt(Form7.Edit1.Text) do
    begin
      MyLabel := TLabel.Create(self);
      MyLabel.Caption := IntToStr(AnzahlEintraege);
      MyLabel.Parent := Form8;
      MyLabel.Left := 45;
      MyLabel.Top := MyTop;
      MyLabel.Show;
      MyEdit := TEdit.Create(self);
      MyEdit.Parent := Form8;
      MyEdit.Left := 115;
      MyEdit.Top := MyTop - 2;
      MyEdit.Width := 335;
      MyEdit.Show;
      MyTop := MyTop + 35;
    end;
  Button1.Top := MyTop + 25;
  Button2.Top := MyTop + 25;
  Form8.Height := MyTop + 105;
end;


procedure TForm8.Button1Click(Sender: TObject);

var
AnzahlEintraege: Byte;
MyEdit: TEdit;
ini: TIniFile;

begin
  {Passwort-Datei speichern}
  DeleteFile(ExtractFilePath(ParamStr(0))+'\Daten\Test.ini');
  ini := TIniFile.Create(ExtractFilePath(ParamStr(0))+'\Daten\Test.ini');
  ini.WriteInteger('Test', 'Anzahl', StrToInt(Form7.Edit1.Text));
  for AnzahlEintraege := 1 to StrToInt(Form7.Edit1.Text) do
    begin
      ini.WriteString('Test', 'Eintrag'+IntToStr(AnzahlEintraege), ???);
    end;
  ini.free;
  Form8.Close;
end;


Vielleicht kann mir jemand helfen.

Bis dann Alex

Moderiert von user profile iconGausi: Code- durch Delphi-Tags ersetzt
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 16.09.07 16:32 
Schau Dir mal FindComponent an.

Außerdem solltest Du deinen Code in Delphi-Tags einschließen, da er dadurch etwas übersichtlicher zu lesen wird.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.