Autor Beitrag
superchatti
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 296

Win XP, Red Hat Linux 7.3
Delphi 6 PE
BeitragVerfasst: So 20.07.03 12:09 
Ich benutze folgenden Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TfrmSchluss.FormShow(Sender: TObject);
var
i:integer;
it:TListItem;
begin
for i:=1 to frmMain.PageControl1.PageCount do begin
  if frmMain.PageControl1.Pages[i].Caption <> 'Unbenannt' then begin
    CheckListBox1.Items.Add(frmMain.PageControl1.Pages[i].Caption);
  end else begin
    it:=ListView1.Items.Add;
    it.Caption := frmMain.PageControl1.Pages[i].Caption;
  end;
end;
end;


Aber wenn ich nun das Form anzeige meint der:
Zitat:
ListIndex out of bounds(1)!


Was läuft schief?

Moderiert von user profile iconTino: Titel geändert & Topic verschoben

_________________
mfG Superchatti
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 20.07.03 12:27 
Hallo

Zitat:

for i:=1 to frmMain.PageControl1.PageCount do begin

es fängt bei 0 an under letzte index ist PageCount-1 . Wenn du von 1 anfängst zu zählen müßtest du
ausblenden Delphi-Quelltext
1:
frmMain.PageControl1.Pages[i-1].Caption					

schreiben.
ausblenden Delphi-Quelltext
1:
for i:=0 to frmMain.PageControl1.PageCount-1 do begin					

is aber eindeutiger (finde ich).

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)


Zuletzt bearbeitet von Keldorn am So 20.07.03 12:28, insgesamt 1-mal bearbeitet
fcg
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: So 20.07.03 12:28 
Titel: Re: FormShow Problem
superchatti hat folgendes geschrieben:
Ich benutze folgenden Code:
ausblenden Delphi-Quelltext
1:
for i:=1 to frmMain.PageControl1.PageCount do begin					


Wenn ich hinter PageCOunt nen -1 Also:

ausblenden Delphi-Quelltext
1:
for i:=1 to frmMain.PageControl1.PageCount-1 do begin					


schreibe geht es bei mir...

//edit: ok, ich war zu langsam...

fcg

_________________
.: Wer für alles offen ist, kann nicht ganz dicht sein! :.
superchatti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 296

Win XP, Red Hat Linux 7.3
Delphi 6 PE
BeitragVerfasst: So 20.07.03 12:45 
Thx!

_________________
mfG Superchatti