加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

vb.net-2010 – OnCreateMainForm()Sub中的Application.Designer

发布时间:2020-12-17 07:22:50 所属栏目:百科 来源:网络整理
导读:我无法弄清楚这里的问题是什么.我从头开始项目,去调试,并收到错误: System.InvalidOperationException was unhandled Message=An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to
我无法弄清楚这里的问题是什么.我从头开始项目,去调试,并收到错误:

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.

我不明白为什么在自动生成的文件中发生此错误.以下是完整的代码:

'------------------------------------------------------------------------------
' <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

有什么建议?我无法弄清楚需要在项目属性的应用程序选项卡中进行哪些更改.

解决方法

确保你有一个名为frmMain的Form Class,注意不是文件名而是Class Name.

也许您已将表单文件名重命名为frmMain.vb,但在文件的代码中,类的签名仍然不同.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读