Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Error occurs at:

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.

like image 686
Josh McKearin Avatar asked Dec 26 '22 19:12

Josh McKearin


1 Answers

I got the same error and realized it was because I had declared a private default constructor in the form code. If you created a constructor and didn't make it public, try making it public.

like image 51
chrismay Avatar answered May 17 '23 13:05

chrismay