---------------------------------------- 不行啊,添加了报错,我的程序是基于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?)
因为指不定你这个dll会不会由WPF 或者WebForm引用
不行啊,添加了报错,我的程序是基于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?)
那我的一些通用的数据处理想写在dll里,写成一个类供其它模块调用,假如在dll中发生异常,我如何显示这个异常信息啊?不太写过dll,求指教,谢谢楼上二位!
选添加后才能using
能处理的异常直接处理了,不能处理的直接往外抛。
提前通过if判断一些条件,不满足的throw new MyException("错误消息");
MyException是自定义异常,比如业务异常,数据异常等等在界面层catch
然后才能添加System.Windows.Forms的名空间
右键引用-添加引用,在.NET下选择System.Windows.Forms
第二步:
using System.Windows.Forms;
OK!