Windows Forms Designer - automatically adds namespace in front of class

让人想犯罪 __ 提交于 2019-12-10 15:50:00

问题


I have problem with Visual Studio Designer.

When I display design of a form, designer automatically adds namespace in front of class, which is used as datasource. But this class is in the same namespace as the form.

It is annoying.

Example:

namespace Editor
{
    partial class AddSignalForm
    {
      ...
      this.signalsBS.DataSource = typeof(Signal);

    }
}

Signal is in namespace Editor.

But after I open designer, code is changed to:

namespace Editor
{
    partial class AddSignalForm
    {
      ...
      this.signalsBS.DataSource = typeof(Editor.Signal);

    }
}

Problem is that compiler can not find class Editor.Editor.Signal.


回答1:


You seem to have another class or property named Editor which conflicts with the namespace.



来源:https://stackoverflow.com/questions/7300292/windows-forms-designer-automatically-adds-namespace-in-front-of-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!