当前位置:首页 » 多媒体相关

为什么try..except..在调试过程中报错,而直接运行项目.exe中却运行正常?


procedure   tinput.edit7exit(sender:   tobject);  
  begin  
      try  
      strtofloat(edit7.text);  
      except  
      begin  
      application.messagebox(输入的数据不合法,提示,mb_iconinformation+mb_ok);  
        edit7.setfocus;  
      end;  
      end;  
  end;  
  在编程环境中运行时,输入非法数据总是出错,而直接运行项目.exe文件后程序执行正常?这是为什么??

推荐阅读

  • 知心你我 NEC手写式N930售价2899 [详细内容]
  • 创维今年产手机200万台 12亿建平面显示基地 [详细内容]
  • 中移动国际漫游费大跳水 中国联通欲跟进降价 [详细内容]
  • NEC推出最新娱乐手机N6305 [详细内容]
  • S60省电技巧:不用软件来关闭手机上费电的功能 [详细内容]
  • 珠三角地区嗷嗷待哺 美风投期待对接中国芯 [详细内容]
  • 魔兽大奖?! 竞答七彩虹X1300就可得! [详细内容]
  • 网友回答:
    网友:bluenightsky

    本来就是错误处理啊,在调试环境下当然会显示错误了,而编译成exe出现错误就跳到except中运行不会出现提示

    网友:xybh97102

    tools->debugger   options->language   exceptions->stop   on   delphi   exceptions  
      这个属性设置可以让你的程序在调试的时候是否跳到except中

    网友:maple119

    procedure   tinput.edit7exit(sender:   tobject);  
      begin  
          try  
              strtofloat(edit7.text);  
          except  
                application.messagebox(输入的数据不合法,提示,mb_iconinformation+mb_ok);  
                edit7.setfocus;  
          end;  
      end;  
       
      不可能.如果输入的数据里包括字母,一定会提示出错.  
     

    .

    讨论区

    Login