好的,事情,我的程序运行完美..没有任何错误,直到我在我的表单上添加另一个按钮。
我有一个与数组[1..200]并行的stringgrid。
我有一个删除按钮:
Procedure TForm1.DeleteTeam(TeamName: string);
var
i : integer;
begin
for i := 1 to TotalNumberOfTeams do
begin
if TeamName = SailingTeams[i].TeamName then
begin
sailingTeams[i].AvLapTime := 99999999;
//puts one to delete with largest value to delete
SortArray;
//sorts it so it is at the end of array
sailingTeams[TotalNumberOfTeams] := nil;
TotalNumberOfTeams := TotalNumberOfTeams - 1;
sortArray;
UpdateGrid;
Break;
end;
end;
end;
procedure TForm1.btnDeleteClick(Sender: TObject);
var
TeamName : string;
continue : integer;
begin
TeamName := (strGrid.Cells[0,(strGrid.Row)]);
continue := MessageDlg('Are you sure you wish to delete: '+teamName+'?',mtWarning, mbYESNO, 0);
if continue = mrYES then
DeleteTeam(TeamName);
end;
如果我添加一个按钮并单击它,然后单击删除我收到错误:S:S
只是一个24小时肮脏比赛的家庭项目,所以算法的效率和不重要的东西,但任何想法,为什么我得到这个错误? :S