下面有一段程序:procedure TfrmCreep.FormCreate(Sender: TObject);
var
I:integer;
begin
Steel_type:='普通钢材';
for I:=1 to frmCreep.ComponentCount do
begin
if frmCreep.Components[I-1] is TComboBox then
(frmCreep.Components[I-1] as TComboBox).Text:=
(frmCreep.Components[I-1] as TComboBox).Items[0]
end;
RadioButton1Click(Self);
DbGrid1.Visible := True;
DbGrid1.Height := 158;
DbGrid1.Width := 414;
GroupBox1.Visible := False;
GroupBox2.Visible := False;
Label11.Visible := False;
Label12.Visible := False;
Label13.Visible := False;
Label14.Visible := False;
cbLqi.Visible := False;
cbCHe.Visible := False;
cbStartTime.Visible := False;
cbFckAfterCreep.Visible := False;
cbTubeStyleClick(self);
cbDataBaseClick(self);
end;
提示第一行[Error] creep.pas(871): Statement expected but 'PROCEDURE' found应该怎么处理
var
I:integer;
begin
Steel_type:='普通钢材';
for I:=1 to frmCreep.ComponentCount do
begin
if frmCreep.Components[I-1] is TComboBox then
(frmCreep.Components[I-1] as TComboBox).Text:=
(frmCreep.Components[I-1] as TComboBox).Items[0]
end;
RadioButton1Click(Self);
DbGrid1.Visible := True;
DbGrid1.Height := 158;
DbGrid1.Width := 414;
GroupBox1.Visible := False;
GroupBox2.Visible := False;
Label11.Visible := False;
Label12.Visible := False;
Label13.Visible := False;
Label14.Visible := False;
cbLqi.Visible := False;
cbCHe.Visible := False;
cbStartTime.Visible := False;
cbFckAfterCreep.Visible := False;
cbTubeStyleClick(self);
cbDataBaseClick(self);
end;
提示第一行[Error] creep.pas(871): Statement expected but 'PROCEDURE' found应该怎么处理
这个formcreate是窗体的事件,你点了事件属性IDE就自动产生这个
procedure TfrmCreep.FormCreate(Sender: TObject);
beginend;
procedure TfrmCreep.Button1Click(Sender: TObject);
procedure ChangeItem(AComboBox:TComboBox);
var
I:integer;
AStrings:array of String;
begin
if AComboBox.Items.Indexof(AComboBox.text)>=0 then
setlength(AStrings,AComboBox.Items.Count)
else
setlength(AStrings,AComboBox.Items.Count+1);
AStrings[0]:=AComboBox.text;
if AComboBox.Items.Indexof(AComboBox.text)>=0 then
begin
AComboBox.Items.Delete(AComboBox.Items.Indexof(AComboBox.text));
AComboBox.text:=AStrings[0];
end;
if AComboBox.Items.Count>=1 then
begin
for I:=1 to AComboBox.Items.Count do
AStrings[I]:=AComboBox.Items[I-1];
end;
AComboBox.Items.Clear;
for I:=0 to High(AStrings) do
AComboBox.Items.Add(AStrings[I]);
if AComboBox.Items.Count >= 51 then
AComboBox.Items.Delete(50);
end;
for i:= i+1 do
begin
writeln();
readln();
end;
这样的话读起来方便一些 逻辑也会清楚一点
代码未必错在 procedure TfrmCreep.FormCreate(Sender: TObject);这句,有时是错在procedure 之前的语句