RT。

解决方案 »

  1.   

    添加System.Windows.Forms.dll的引用就可以了不过一般只有界面层才需要MessageBox.
    因为指不定你这个dll会不会由WPF 或者WebForm引用
      

  2.   

    ----------------------------------------
    不行啊,添加了报错,我的程序是基于dll的啊:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    -----------------------------------------
    error CS0234: The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?)
      

  3.   

    ---------------------------------------------
    那我的一些通用的数据处理想写在dll里,写成一个类供其它模块调用,假如在dll中发生异常,我如何显示这个异常信息啊?不太写过dll,求指教,谢谢楼上二位!
      

  4.   

    右键单击项目,添加引用,在.NET标签下选择System.Windows.Forms
      

  5.   

    在项目上打开,有个引用,然后右键添加引用。
    选添加后才能using
      

  6.   


    能处理的异常直接处理了,不能处理的直接往外抛。
    提前通过if判断一些条件,不满足的throw new MyException("错误消息");
    MyException是自定义异常,比如业务异常,数据异常等等在界面层catch 
      

  7.   

    先添加System.Windows.Forms的引用
    然后才能添加System.Windows.Forms的名空间
      

  8.   

    第一步:
    右键引用-添加引用,在.NET下选择System.Windows.Forms
    第二步:
    using System.Windows.Forms;
    OK!
      

  9.   

    dll是类库,为什么要加MessageBox呢?