[問題] MessageBox.Show()的問題
以下是我的程式碼
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int x = 10, y=0,re;
try
{
re=x/y;
}
catch (System.DivideByZeroException ex) {
MessageBox.Show("除數不可以為0");
}
finally {
MessageBox.Show("finally");
}
Console.Read();
}
}
}
我要使用MessageBox.Show的方法,先查了msdn知道要
using System.Windows.Forms;
在編譯後,它卻告訴我
命名空間 'System' 中沒有型別或命名空間名稱 'Windows' (您是否遺漏了組件參考?)
我找不出原因
請各位為什麼會有錯呢
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.117.3.231
推
11/20 16:57, , 1F
11/20 16:57, 1F
→
11/20 16:58, , 2F
11/20 16:58, 2F
→
11/20 17:06, , 3F
11/20 17:06, 3F
※ 編輯: hiroshima 來自: 59.117.3.231 (11/20 17:11)
→
11/20 17:12, , 4F
11/20 17:12, 4F
→
11/20 17:50, , 5F
11/20 17:50, 5F
→
11/20 17:53, , 6F
11/20 17:53, 6F
推
11/20 18:24, , 7F
11/20 18:24, 7F
→
11/20 18:31, , 8F
11/20 18:31, 8F
其實,我是照書上所講的來寫的,書上沒有完整的程式,我以為以用主控台應用程式來寫
原來是要用windows form應用程式來寫,書上也沒講"加入參考"的東西,不曉得是沒有講,
還是我沒讀到,謝謝各位囉
※ 編輯: hiroshima 來自: 59.117.10.164 (11/20 19:39)