Autor Beitrag
marvin521993
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 172



BeitragVerfasst: Do 15.02.07 20:32 
Hallo zusammen...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure TVokabfragen.SpeedButtonLadenClick(Sender: TObject);
begin
If OpenDialog1.Execute Then
 begin
  daten := TStringList.Create;
  daten.LoadFromFile(OpenDialog1.FileName);
 end;
end;


procedure TVokabfragen.ButtonprogrammstartenClick(Sender: TObject);
var i : INteger;
begin
Button2.Caption := 'Bestätigen';
 for i := 0 to 50 do
  begin
   daten := TStringList.Create;
   Edit1.Text := daten.Strings[i+1];
  end;
end;


das ist der quelltext dafür
nur leider klappt es beim start button nicht so, wie ich mir das wünsche.
er überschreitet den listenindex
hoffe mir kann jemand helfen

Mfg
Marvin


Moderiert von user profile iconChristian S.: Topic aus Freeware Projekte verschoben am Do 15.02.2007 um 20:41
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Do 15.02.07 20:36 
Zitat:
ausblenden Delphi-Quelltext
1:
2:
3:
 for i := 0 to 50 do
  begin
   daten := TStringList.Create;

Wieso erzeugst du 50 mal die Stringlist von neuem? :shock:
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 15.02.07 20:44 
vielleicht hat er 50 * 50 (2'500) zeilen, welche es zu laden gibt ;-)
marvin521993 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 172



BeitragVerfasst: Do 15.02.07 20:51 
ups sry kleiner anfänger fehler^^
aber es muss ein fehler mit den strings sein anders könnte ich mir das nich erklären...

Mfg
Marvin
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Do 15.02.07 21:06 
Was soll überhaupt passieren?
Wie sieht dein neuer Code jetzt aus?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure TVokabfragen.SpeedButtonLadenClick(Sender: TObject);
begin
If OpenDialog1.Execute Then
 begin
  daten := TStringList.Create;
  daten.LoadFromFile(OpenDialog1.FileName);
 end;
end;


procedure TVokabfragen.ButtonprogrammstartenClick(Sender: TObject);
var i : INteger;
begin
Button2.Caption := 'Bestätigen';
 for i := 0 to 50 do //warum bis 50? Wie wäre es mit daten.count - 1 ? ;)
  begin
   daten := TStringList.Create; //weg damit ^-^
   Edit1.Text := daten.Strings[i+1]; //Warum + 1?
  end;
end;

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot