我该如何解决这种形式的错误?

编程

[ad_1]

C#
namespace Skills_International
{
    public partial class Form1 : Form
    {
        private object txtpassword;
        private object txtpassword;

        public Form1()
        {
            InitializeComponent();
        }

此错误的实例 (1)

1.   Skills International Form1.Designer.cs Line:35 Column:1   Show Call Stack  
 
at Microsoft.DotNet.DesignTools.Client.CodeDom.Roslyn.CSharp.CSharpCodeDomService.Reader.AddMethod(MethodDeclarationSyntax methodDeclaration, CodeTypeMemberCollection collection)
at Microsoft.DotNet.DesignTools.Client.CodeDom.Roslyn.CSharp.CSharpCodeDomService.Reader.AddClass(ClassDeclarationSyntax classDeclaration, IList collection)
at Microsoft.DotNet.DesignTools.Client.CodeDom.Roslyn.CSharp.CSharpCodeDomService.Reader.AddNamespace(BaseNamespaceDeclarationSyntax namespaceDeclaration, CodeNamespaceCollection collection)
at Microsoft.DotNet.DesignTools.Client.CodeDom.Roslyn.CSharp.CSharpCodeDomService.Reader.Read()
at Microsoft.DotNet.DesignTools.Client.CodeDom.Roslyn.RoslynCodeDomService.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.DotNet.DesignTools.Client.CodeDom.Roslyn.RoslynCodeDomService.d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DotNet.DesignTools.Client.CodeDom.CodeDomSource.d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DotNet.DesignTools.Client.CodeDom.CodeDomSource.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DotNet.DesignTools.Client.CodeDom.CodeDomManager.d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DotNet.DesignTools.Client.CodeDom.CodeDomManager.d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DotNet.DesignTools.Client.Loader.VsDesignerLoader.d__59.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DotNet.DesignTools.Client.Loader.VsDesignerLoader.<>c__DisplayClass57_0.<b__1>d.MoveNext()

帮忙解决这个错误

MSDN 帮助

有关此错误的论坛帖子

在 MSDN 论坛中搜索与此错误相关的帖子

我尝试过的:

我已经尝试了上面的代码,但我仍然收到 txtusername 和 txtpassword 作为错误

解决方案1

如果无法访问您的系统,我们无法真正为您提供帮助 – 可用的信息太少,无法具体说明。
然而,因为这似乎是你的 Form1.cs 文件中,很可能是您添加的两行导致了问题 – 注释掉这些行并查看错误是否消失:

private object txtpassword;
private object txtpassword;

为什么有两个同名的变量,为什么它们被声明为 object 值和前缀“txt” 通常表示一个 TextBox – 这意味着它们可能已经作为 TextBox 控件存在于您的表单中 – 在这种情况下,新名称也会与系统添加到 Form1.designer.cs 它维护并用于在设计视图中显示表单的文件。

[ad_2]

コメント

标题和URL已复制