gpt4 book ai didi

c# - 用户控件中的 "Type or namespace name could not be found"

转载 作者:太空宇宙 更新时间:2023-11-03 17:17:32 24 4
gpt4 key购买 nike

我想在用户控件中执行以下操作:

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.Web.UI.WebControlsSystem.Windows.Forms(取决于您正在开发的应用程序的类型) >使用指令。

关于c# - 用户控件中的 "Type or namespace name could not be found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15813184/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com