L
lcl_003
Unregistered / Unconfirmed
GUEST, unregistred user!
啊,我都快疯了,窗体一创建就提示:
Projiect LTest.exe raised exception cless EConvertError with message '' 'is not
a valid integer value'.Process stopped.Use Step or Run to continue.
我继续运行就会提示“文件操作失败”好想和我操作的文件有关。
在窗体关闭的时候就会死掉。这到底是咋回事我的窗体创建和关闭的代码如下:
implementation
{$R *.dfm}
var
filepath:string;
sensorfile:textfile;
ich:smallint;
flagchang:integer;
ss: string;
stype0,snum0,stype1,snum1:array[0..chMax] of string;
vdate:variant;
izr0,igr0:array[0..chMax] of smallint;
izr1,igr1:array[0..chMax] of smallint;
procedure TTdbd1.FormCreate(Sender: TObject);
var
cc:smallint;
begin
flagchang:=0;
try
filepath:=GetCurrentDir();
assignfile(sensorfile,filepath+'/def/sensor.def');
reset(sensorfile);
readln(sensorfile,ss);
vdate:=ss;
for cc:=0 to (chMax-1) do
begin
readln(sensorfile,stype0[cc]);
readln(sensorfile,snum0[cc]);
readln(sensorfile,stype1[cc]);
readln(sensorfile,snum1[cc]);
readln(sensorfile,ss);
izr0[cc]:=strtoint(ss);
readln(sensorfile,ss);
igr0[cc]:=strtoint(ss);
readln(sensorfile,ss);
izr1[cc]:=strtoint(ss);
readln(sensorfile,ss);
igr1[cc]:=strtoint(ss);
end;
CloseFile(sensorfile);
except
showmessage('文件操作失败');
end;
ich := 0;
panCHNum.Caption := inttostr(ich+1);
panCHname.Text := strName[ich];
panDate.Text := vartostr(vdate);
editSensorType0.Text := stype0[ich];
editSensorNum0.Text := snum0[ich];
panFullS0.Text:= floattostr(rFullScale0[ich]);
lad0.Caption := '载荷反馈('+strULoad[intUnit0[ich]]+')';
scZeroReg0.Max :=4095;
scZeroReg0.Min :=0;
scZeroReg0.Position := izr0[ich];
panZeroReg0.Text := floattostr((1000000*(izr0[ich]-2048) div 2048)/1000000);
scGainReg0.Max :=4095;
scGainReg0.Min :=0;
scGainReg0.Position := igr0[ich];
panGainReg0.Text:= floattostr((1000000*(igr0[ich]-2048) div 2048)/1000000);
end;
procedure TTdbd1.FormClose(Sender: TObject; var Action: TCloseAction);
var
rr:word;
cc:smallint;
begin
if flagchang>0 then
begin
rr:=messagedlg('是否保存设定数据?',mtWarning,[mbYes,mbNo],0);
if rr=1 then
begin
try
vdate := date();
filepath:=GetCurrentDir();
assignfile(sensorfile,filepath+'/def/sensor.def');
rewrite(sensorfile);
writeln(sensorfile,vdate);
for cc:=0 to (chMax-1) do
begin
writeln(sensorfile,stype0[cc]);
writeln(sensorfile,snum0[cc]);
writeln(sensorfile,stype1[cc]);
writeln(sensorfile,snum1[cc]);
writeln(sensorfile,inttostr(izr0[cc]));
writeln(sensorfile,inttostr(igr0[cc]));
writeln(sensorfile,inttostr(izr1[cc]));
writeln(sensorfile,inttostr(igr1[cc]));
end;
CloseFile(sensorfile);
except
showmessage('文件操作失败');
end;
flagchang:=0;
end;
end;
end;
Projiect LTest.exe raised exception cless EConvertError with message '' 'is not
a valid integer value'.Process stopped.Use Step or Run to continue.
我继续运行就会提示“文件操作失败”好想和我操作的文件有关。
在窗体关闭的时候就会死掉。这到底是咋回事我的窗体创建和关闭的代码如下:
implementation
{$R *.dfm}
var
filepath:string;
sensorfile:textfile;
ich:smallint;
flagchang:integer;
ss: string;
stype0,snum0,stype1,snum1:array[0..chMax] of string;
vdate:variant;
izr0,igr0:array[0..chMax] of smallint;
izr1,igr1:array[0..chMax] of smallint;
procedure TTdbd1.FormCreate(Sender: TObject);
var
cc:smallint;
begin
flagchang:=0;
try
filepath:=GetCurrentDir();
assignfile(sensorfile,filepath+'/def/sensor.def');
reset(sensorfile);
readln(sensorfile,ss);
vdate:=ss;
for cc:=0 to (chMax-1) do
begin
readln(sensorfile,stype0[cc]);
readln(sensorfile,snum0[cc]);
readln(sensorfile,stype1[cc]);
readln(sensorfile,snum1[cc]);
readln(sensorfile,ss);
izr0[cc]:=strtoint(ss);
readln(sensorfile,ss);
igr0[cc]:=strtoint(ss);
readln(sensorfile,ss);
izr1[cc]:=strtoint(ss);
readln(sensorfile,ss);
igr1[cc]:=strtoint(ss);
end;
CloseFile(sensorfile);
except
showmessage('文件操作失败');
end;
ich := 0;
panCHNum.Caption := inttostr(ich+1);
panCHname.Text := strName[ich];
panDate.Text := vartostr(vdate);
editSensorType0.Text := stype0[ich];
editSensorNum0.Text := snum0[ich];
panFullS0.Text:= floattostr(rFullScale0[ich]);
lad0.Caption := '载荷反馈('+strULoad[intUnit0[ich]]+')';
scZeroReg0.Max :=4095;
scZeroReg0.Min :=0;
scZeroReg0.Position := izr0[ich];
panZeroReg0.Text := floattostr((1000000*(izr0[ich]-2048) div 2048)/1000000);
scGainReg0.Max :=4095;
scGainReg0.Min :=0;
scGainReg0.Position := igr0[ich];
panGainReg0.Text:= floattostr((1000000*(igr0[ich]-2048) div 2048)/1000000);
end;
procedure TTdbd1.FormClose(Sender: TObject; var Action: TCloseAction);
var
rr:word;
cc:smallint;
begin
if flagchang>0 then
begin
rr:=messagedlg('是否保存设定数据?',mtWarning,[mbYes,mbNo],0);
if rr=1 then
begin
try
vdate := date();
filepath:=GetCurrentDir();
assignfile(sensorfile,filepath+'/def/sensor.def');
rewrite(sensorfile);
writeln(sensorfile,vdate);
for cc:=0 to (chMax-1) do
begin
writeln(sensorfile,stype0[cc]);
writeln(sensorfile,snum0[cc]);
writeln(sensorfile,stype1[cc]);
writeln(sensorfile,snum1[cc]);
writeln(sensorfile,inttostr(izr0[cc]));
writeln(sensorfile,inttostr(igr0[cc]));
writeln(sensorfile,inttostr(izr1[cc]));
writeln(sensorfile,inttostr(igr1[cc]));
end;
CloseFile(sensorfile);
except
showmessage('文件操作失败');
end;
flagchang:=0;
end;
end;
end;