我想做的用戶控件如下:「類型或命名空間名稱找不到」在用戶控件
foreach(Control c in this.Controls)
{
if(c is CheckBox)
{
// Do stuff here
}
}
但我得到的錯誤:
Error 1 The type or namespace name 'Control' could not be found (are you missing a using directive or an assembly reference?)
Error 2 The type or namespace name 'CheckBox' could not be found (are you missing a using directive or an assembly reference?)
三江源指導。
你看了錯誤消息System.Windows.Controls?它告訴你到底是什麼問題。您需要導入對應於'Control'和'Checkbox'的2個DLL。 – tnw 2013-04-04 13:52:10
您是否導入了'System.Windows.Forms.Control'? – Joetjah 2013-04-04 13:51:14