使用 MessageBox.Show 需要引入 using System.Windows.Forms;
引入 using System.Windows.Forms; 再次报错:
- 错误 命名空间“System”中不存在类型或命名空间名称“Windows”。是否缺少程序集引用?
【解决过程】
此错误原因是缺少了对应的dll库System.Windows.Forms.dll,即需要添加对System.Windows.Forms.dll库的引用。
方法是:
右击项目名下面的那个“引用” -> 添加引用 –> .NET –> 在“组建名称”中找到”System.Windows.Forms”并添加。
即可解决此问题。
ini_path += "\\Project.ini";
if (!File.Exists(ini_path))
{
System.Windows.Forms.MessageBox.Show("Project.ini文件不存在:"+ini_path, (String)rm.GetObject("Message_Error"), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
}