Autor Beitrag
Terra23
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Mo 06.05.13 23:03 
Hi!

Ich habe ein Problem. Ich lade aus einer Datei, die mit meinem Programm gespeichert wurde diese auch wieder.

Leider kriege ich immer die Meldung bei Exception.

Hier mal der Code:

ausblenden 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:
If Not OpenDialog1.Execute Then Exit;

Try
  Try
  Loadstream := TStringList.Create;
  Loadstream.LoadFromFile(OpenDialog1.FileName);

  /// Fülle die Variablen für Monster-, Zauber- und Fallenkarten des Main Decks
  Anz_Monster := StrToInt(Loadstream[0]);
  Anz_Zauber := StrToInt(Loadstream[1]);
  Anz_Fallen := StrToInt(Loadstream[2]);   /// BIS HIERHER KLAPPT ALLES

  /// Finde heraus, wo die Decks getrennt wurden (durch @)...
  For I := 0 To Loadstream.Count Do /// AB HIER FÜHRT ES ZU PROBLEMEN. ÜBERLEGUNG: Loadstream.COUNT ist falsch???
    Begin
    Pos_Mainbox := 3;
    If Loadstream[I] = '@Sidebox' Then Pos_Sidebox := I;
    If Loadstream[I] = '@Extrabox' Then Pos_Extrabox := I;
    If Loadstream[I] = '@Gesamtbox' Then Pos_Gesamtbox := I;
    If Loadstream[I] = '@Mainbox2' Then Pos_Mainbox2 := I;
    If Loadstream[I] = '@Sidebox2' Then Pos_Sidebox2 := I;
    If Loadstream[I] = '@Extrabox2' Then Pos_Extrabox2 := I;
    If Loadstream[I] = '@END' Then Pos_End := I;
    End;

/// Hier kommt noch mehr Code, der unwichtig ist...


Ich habe immer Stückweise den Code in {} gesetzt und herausgefunden, dass EXCEPT ERST DURCHLAUFEN WIRD, wenn ich den Block mit der FOR-Schleife durchlaufen lasse. Ich hab gegoogelt aber COUNT scheint richtig zu sein...

Sieht jemand meinen Fehler?


Gruß,

Terra

_________________
Hasta La Victoria Siempre
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 06.05.13 23:05 
Moin!

user profile iconTerra23 hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Delphi-Quelltext
1:
2:
3:
  /// Finde heraus, wo die Decks getrennt wurden (durch @)...
  For I := 0 To Loadstream.Count-1 Do /// AB HIER FÜHRT ES ZU PROBLEMEN. ÜBERLEGUNG: Loadstream.COUNT ist falsch???
    Begin
cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.

Für diesen Beitrag haben gedankt: Terra23
Terra23 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Mo 06.05.13 23:08 
:oops: :oops: :oops:
OH MY GOD!

Ey, das darfste keinem sagen, Narses. Soooo blockiert war ich lang nicht mehr. Natürlich gehört da ne "-1" hin. Alter, WTF? Danke, dass du so schnell reagiert hast. Das ist echt oberpeinlich....

_________________
Hasta La Victoria Siempre