Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VB.NET用户控件_Vb.net_User Controls - Fatal编程技术网

VB.NET用户控件

VB.NET用户控件,vb.net,user-controls,Vb.net,User Controls,我试图在VS2010下的VB.net中创建一个UserControl。我有UserControl的代码,我想将其添加到表单中。我的问题是,根据我看过的每一本书和论坛,在我构建UserControl之后,它应该出现在工具箱中。没有。我甚至从一本书中下载了代码,代码执行得非常完美,但是他们的TrafficLight控件并没有放在工具箱中(尽管书中说应该放在工具箱中,而且设置其属性并将其添加到表单的唯一方法是通过控件属性)。我试图通过声明控件来手动将其添加到表单中 Dim myObj As New S

我试图在VS2010下的VB.net中创建一个UserControl。我有UserControl的代码,我想将其添加到表单中。我的问题是,根据我看过的每一本书和论坛,在我构建UserControl之后,它应该出现在工具箱中。没有。我甚至从一本书中下载了代码,代码执行得非常完美,但是他们的TrafficLight控件并没有放在工具箱中(尽管书中说应该放在工具箱中,而且设置其属性并将其添加到表单的唯一方法是通过控件属性)。我试图通过声明控件来手动将其添加到表单中

Dim myObj As New SomeClass.SomeControl
在Designer.vb中,与窗体上的按钮相同:

Friend WithEvents myObj As SomeClass.SomeControl
两种情况下,我都有一个错误

'myObj' is already declared as 'Friend WithEvents myObj As SomeControl' in this class.
无论哪种方式,当我尝试查看设计时都会出现错误:

Could not find type 'SomeClass.SomeControl'. Please make sure that the assembly that contains this type is referenced. If this type is part of your development project, make sure the project has been successfully built using settings for your current platform or AnyCPU.
控件本身构建并显示在设计视图中(但不在工具箱中,即使它
导入System.ComponentModel
继承System.Windows.Forms.UserControl
和…还有什么?我试图在单独的项目中构建它,以查看创建单独的dll是否会有所不同,尽管我确实希望它在同一个项目中。
请帮忙!(顺便说一句,我已经重新安装了VS2010,但没有效果)

谢谢。

查看工具/选项/Windows窗体设计器并将“AutoToolboxPopulate”设置为True(但请注意,如果您有多个(即几十个)用户控件,则这可能需要相当长的时间。

查看工具/选项/Windows窗体设计器并将“AutoToolboxPopulate”设置为True(但请注意,如果你有很多(如几十个),这可能需要相当长的时间)用户控件。

您是否尝试过右键单击工具箱并选择“选择项”?您是否尝试过右键单击工具箱并选择“选择项”?非常感谢,这在故障排除方面帮了我很多忙。知道为什么控件会出现在x86中而不是x64中吗?不-以前从未听说过这种奇怪的情况!非常感谢,它在故障排除方面帮了我很大的忙。你知道为什么控件会出现在x86中而不是x64中吗?不,以前从未听说过这种奇怪的事情!