procedure TForm1.Button2Click(Sender: TObject); begin while true do begin if OpenDialog1.Execute then begin if not FileExists(Opendialog1.FileName) then Application.MessageBox('文件不存在!!','提示',MB_OK+MB_IconError) else begin Label1.Caption:=Opendialog1.FileName; Break; end end else //按下的是“取消” Break; end;
begin
while true do
begin
if OpenDialog1.Execute then
begin
if not FileExists(Opendialog1.FileName) then
Application.MessageBox('文件不存在!!','提示',MB_OK+MB_IconError)
else
begin
Label1.Caption:=Opendialog1.FileName;
Break;
end
end
else //按下的是“取消”
Break;
end;