私はサイコロをシミュレートし、それらをチャート (文字列リストのセット) の値と比較するプログラムを持っています。現在、TEdit から値を取得しています。ボックスが空の場合、Try/Except ステートメントでキャッチする必要がある EConvertError が発生しますが、そうではありません。感想とアドバイス?以下のコード、Delphi 7。
try
//Shooting
if ShootingRadio.Checked then
BS := StrToInt(Edit1.Text);
Randomize;
Roll := RandomRange(1,7);
Label3.Caption := IntToStr(Roll);
if (Roll < StrToInt(ShootingHitChart[BS-1])) then
begin
Label3.Caption := (IntToStr(Roll)+' Miss');
RichView1.AddTextNL((IntToStr(Roll)+' Miss'),7,0,1);
RichView1.Reformat;
end
else
begin
Label3.Caption := (IntToStr(Roll)+' Hit');
RichView1.AddTextNL((IntToStr(Roll)+' Hit'),6,0,1);
RichView1.Reformat;
end;
except
MessageBox(0,'No number entered.','Error',mb_OK);
end;