Autor Beitrag
Arbengie
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 66



BeitragVerfasst: Mo 28.06.10 13:31 
Hi ich wollte mal fragen, wie ich mit FindComponent in einer .ini datei etwas aus einer Section auslesen kann...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TMainForm.FormCreate(Sender: TObject);
var
  i: integer;
begin
  ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Termine.ini');
  If ini.SectionExists('Settings') then
  begin
    iAnzahl2 := StrToInt(ini.ReadString('Settings','Index',''));
    for i := 1 to iAnzahl2 do
    begin
      ListBox.Items.Add(ini.ReadString(FindComponent('Termin' + IntToStr(iAnzahl2)),'Titel',''));
    end;
  end;
end;

//----------------

[Error] uMain.pas(51): Incompatible types: 'String' and 'TComponent'



Moderiert von user profile iconNarses: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mo 28.06.2010 um 14:38
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mo 28.06.10 13:35 
probiers mal so und sag mir ob es das macht was du willst:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TMainForm.FormCreate(Sender: TObject);
var
  i: integer;
begin
  ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Termine.ini');
  If ini.SectionExists('Settings') then
  begin
    iAnzahl2 := StrToInt(ini.ReadString('Settings','Index',''));
    for i := 1 to iAnzahl2 do
    begin
      ListBox.Items.Add(ini.ReadString('Termin' + IntToStr(iAnzahl2),'Titel',''));
    end;
  end;
end;


denn um ehrlich zu sein, weiß ich nicht was du mit dem findcomponent da drin im String-Parameter der readstring-anweisung willst.

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.