在 OnCreateMainForm() Sub 中的 Application.Designer.vb 中的错误 [英] Error inside of Application.Designer.vb inside of OnCreateMainForm() Sub
问题描述
我无法弄清楚这里的问题是什么.我从头开始项目,去调试,收到错误:
I can't figure out what the issue is here. I started project from scratch, went to debug, and received error:
System.InvalidOperationException 未被处理 Message=一个错误创建表单时发生.有关详细信息,请参阅 Exception.InnerException.错误是:未将对象引用设置为对象的实例.
System.InvalidOperationException was unhandled Message=An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object.
我不明白为什么在自动生成的文件中会发生此错误.完整代码如下:
I am not understand why this error is occurring in an auto-generated file. Here is the code in it's entirety:
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.269
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.AccountAndClientFull.frmMain 'HERE IS WHERE THE ERROR OCCURS
End Sub
End Class
End Namespace
错误发生在:
Me.MainForm = Global.AccountAndClientFull.frmMain
Me.MainForm = Global.AccountAndClientFull.frmMain
有什么建议吗?我无法弄清楚需要在项目属性的应用程序选项卡中进行哪些更改.
Any suggestions? I can't figure out what changes need to be made in the application tab of the project properties.
推荐答案
确保你有一个名为 frmMain 的 Form Class,注意不是文件名而是 >班级名称.
Make sure you have a Form Class called frmMain, attention not the file name but the Class Name.
也许您已将表单文件名重命名为 frmMain.vb,但在文件的代码中,类的签名仍然不同.
Maybe you have renamed the Form file name to frmMain.vb but in the code of the file the signature of the class remains different.
这篇关于在 OnCreateMainForm() Sub 中的 Application.Designer.vb 中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!