[Delphi] Petla "for" nie dziala :(

0

witam ;>

juz mnie #@&#@ bierze... jedna funkcja w moim programie nie dziala... probowalem wszystkie sposoby, az doszlem do najprostszego:

          for i := 0 to 4 do
            begin
            showmessage(IntToStr(i));
              Form1.ListBox1.Items.Add('- '+Form1.Memo7.Lines.Strings[i]);
              Form1.GGLite1.GGAddUserNotify(StrToInt(Form1.Memo8.Lines.Strings[i]));
            end

"for i := 0 to 4 do" <= poki "i" nie bedzie sie rownalo "4" bedzie powstarzac kod dodajac +1 do "i"
"showmessage(IntToStr(i));" <= wyswteila komunikat z aktualna wartosia zmiennej "i"

jak widac powinno sie pojawic 5 razy (albo 4 ;p nie jaze teraz ;] - 0, 1, 2, 3, 4) ale sie pojawia tylko raz! ;o pokazuje mi "0" i koniec.. pewnie gdzies indziej jest blad wiec wkleje kod calej funkcjii :>

procedure ImportServerList; // Wyswietla liste kontaktow w ListBoxie
var
  Name, Number: String;
  i, Servers: Integer;

begin
  AddLog('blabla');

  for i := 0 to Form1.Memo5.Lines.Count do
    if Length(Form1.Memo5.Lines.Strings[i]) > 10 then
      begin
        Name := Copy(Form1.Memo5.Lines.Strings[i], 0, Pos('|', Form1.Memo5.Lines.Strings[i])-1);
        Number := Copy(Form1.Memo5.Lines.Strings[i], Pos('|', Form1.Memo5.Lines.Strings[i])+1, Length(Form1.Memo5.Lines.Strings[i]));

        Form1.Memo7.Lines.Add(Name);
        Form1.Memo8.Lines.Add(Number);

        Servers := i;
      end;

      for i := 0 to Form1.Memo7.Lines.Count do
        begin
          if Form1.Memo7.Lines.Strings[i] = '' then
            Form1.Memo7.Lines.Delete(i)
          else if Length(Form1.Memo7.Lines.Strings[i]) < 3 then
            Form1.Memo7.Lines.Delete(i)
        end;

      for i := 0 to Form1.Memo8.Lines.Count do
        begin
          if Form1.Memo8.Lines.Strings[i] = '' then
            Form1.Memo8.Lines.Delete(i)
          else if Length(Form1.Memo8.Lines.Strings[i]) < 1 then
            Form1.Memo8.Lines.Delete(i);
        end;

      if Form1.Memo7.Lines.Count <> Form1.Memo8.Lines.Count then
        begin
          AddLog('blabla.');

          Form1.Memo7.Clear;
          Form1.Memo8.Clear;

          MsgBox('blabla.', 3);

          AddLog('blabla');

           if Application.MessageBox('blabla', PAnsiChar(ProgramName), MB_YESNO or MB_ICONQuestion) = IdYes then
            begin
              Form1.GGLite1.GGExportContactsList('');

              ControledDisconnect := True;
              TryDisconnectClient;
              MsgBox('blabla', 1);
            end
           else
            ControledDisconnect := True;
            TryDisconnectClient;

            MsgBox('blabla', 1);
        end
      else
        begin
          for i := 0 to 4 do
            begin
            showmessage(IntToStr(i));
              Form1.ListBox1.Items.Add('- '+Form1.Memo7.Lines.Strings[i]);
              Form1.GGLite1.GGAddUserNotify(StrToInt(Form1.Memo8.Lines.Strings[i]));
            end
        end;
end;
0

nie da sie skasowac tematu - szkoda =\

problem znalazlem ;p a wlasciwie bylo ich kilka, najpowazniejszy to chyba:

Form1.GGLite1.GGAddUserNotify(StrToInt(Form1.Memo8.Lines.Strings[i]));

petla to wykonywala za szybko i sie popsulo ;]

1 użytkowników online, w tym zalogowanych: 0, gości: 1