如题谢谢

解决方案 »

  1.   

    winform application 的程序集事件都是可控的,因为不是依付iis而运行,所以不需要global
      

  2.   

    在Program类里面放一个静态的字段,属性,方法都可以
      

  3.   

    我的意思想实现这样的效果,
    因为Golbal里面有个Error,
    当程序发生错误的时候自动运行这里,我可以在这里统一控制,
    请问在Winform application 如何控制呢
    谢谢
      

  4.   

    全局类?要自己定义static class和static字段
      

  5.   

    定义了全局类,如何判断一个错误得到一个错误呢
    像Gobal那样 自动获得
      

  6.   

    没有这个东东,自己写一个 static class gloabl, 把全局的东西放到该类里面来
      

  7.   

    我可以写一个全局的类,但是如何捕捉程序出错了呢?不可以每段代码都要加Try Catch的
    谢谢
      

  8.   

    没有。可定义全局变量,可使用app.config
      

  9.   

    用 Application.SetUnhandledExceptionMode Method ,
    分别对应
    Automatic Route all exceptions to the ThreadException handler, unless the application's configuration file specifies otherwise.  
     CatchException Always route exceptions to the ThreadException handler. Ignore the application configuration file.  
     ThrowException Never route exceptions to the ThreadException handler. Ignore the application configuration file.  
      

  10.   

    自定义一个全局的公共函数处理异常
    try catch(){此处用自定义的函数}
      

  11.   

    楼上说的可以实现,但是问题是难道每一个函数都要加try catch{}
    在bs里有这样一个页,只要函数里发生了错误,而没有加try catch{} 错误会自动跑到Global.asax的这个函数里,
    请问 在winform里有这样的功能吗?