Einzelnen Beitrag anzeigen

thiagojonas

Registriert seit: 31. Aug 2008
Ort: Wolfenbüttel
338 Beiträge
 
#1

Maximum wir überschritten!

  Alt 20. Okt 2008, 13:20
Hallo jungs.
Ich kriege hierbei immer eine Fehlermeldung. Das Maximum des Listenindex (-1) wir überschritten.
Was ist hier falsch?

Delphi-Quellcode:
procedure TForm1.start_btnClick(Sender: TObject);
var datum:string;
var Txt2Find : String;
    Index : Integer;

 function GetGrid2Index(Grid:TStringGrid;Txt2Find:String):Integer;
 var i : Integer;
 begin
  Result:=-1;
  with Grid do
   for i:=FixedRows to RowCount -1 do
    if (form4.StringGrid.Cells[1,i] = Txt2Find) then begin // < we compare col 1
     Result:=i;
     Break;
     end;
   end;

begin
      datum := DateToStr(Now);
      Txt2Find:=ComboBox.text;
      Index :=GetGrid2Index(form4.StringGrid,Txt2Find);
   if Index>-1 then
   if calculate_dg.Cells[calculate_dg.FixedCols,Pred(calculate_dg.RowCount)] <> 'then
      calculate_dg.RowCount := Succ(calculate_dg.RowCount);
      calculate_dg.Cells[calculate_dg.FixedCols,Pred(calculate_dg.RowCount)] := form4.StringGrid.Cells[0,Index];
      calculate_dg.Cells[1,Pred(calculate_dg.RowCount)] := ComboBox.text;
      calculate_dg.Cells[2,Pred(calculate_dg.RowCount)] := form4.StringGrid.Cells[8,Index];
      calculate_dg.Cells[3,Pred(calculate_dg.RowCount)] := protokoll_cb.Text;
      calculate_dg.Cells[4,Pred(calculate_dg.RowCount)] := '';
      calculate_dg.Cells[5,Pred(calculate_dg.RowCount)] := datum;
      calculate_dg.Cells[6,Pred(calculate_dg.RowCount)] := FormatDateTime('hh:mm',now);
      SaveStringGrid(calculate_dg, 'Data/Penein/'+Txt2Find+'/'+Txt2Find+'.ini');
    end;
  end;
  Mit Zitat antworten Zitat