错误4:找不到类型或命名空间名称'usercontrol1'(您是否缺少using指令或程序集引用?) [英] Error 4 : the type or namespace name 'usercontrol1' could not be found (are you missing a using directive or an assembly reference? )

查看:282
本文介绍了错误4:找不到类型或命名空间名称'usercontrol1'(您是否缺少using指令或程序集引用?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我构建项目时,我从其他人那里得到了这个代码,上面提到的错误发生了。

帮帮忙,如果有人知道请



我尝试过:



I got this code from others when I build project the above mentioned error occurs .
help out , if someone of you know please

What I have tried:

private UserControl1 userControl11;

推荐答案

您需要让编译器知道UserControl1类所在的命名空间。要么使其显式



You need to let the compiler know which namespace the UserControl1 class is in. Either make it explicit

private MyNamespace.UserControl1 userControl1;





或添加相关的使用声明到页面顶部





or add the relevant "using" statement to the top of the page

using MyNamespace;





您应该能够右键单击UserControl1,并且根据您的VS版本,上下文菜单中会有一些重构选项可以为您执行这些操作。 />


如果它不是缺少的命名空间,那么它可能是某个地方缺少的引用。我们不可能知道为什么你的代码找不到某个类。



You should be able to right-click UserControl1 and depending on your version of VS there will be some kind of "refactor" option in the context menu that will do these things for you.

If it's not the missing namespace then it might be a missing reference somewhere. It's impossible for us to know why your code can't find a certain class.


这篇关于错误4:找不到类型或命名空间名称'usercontrol1'(您是否缺少using指令或程序集引用?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆