System.InvalidOperationException: 'Application-defined or object-defined error.'

Malcolm Fellmann 5 Reputation points
2024-05-04T14:50:52.45+00:00

Debugging gives me a "Exception Unhandled" error in the Application.Designer:

32 <Global.System.Diagnostics.DebuggerStepThroughAttribute()>

33 Protected Overrides Sub OnCreateMainForm()

34 Me.MainForm = Form1 <<< HERE MARKED WITH A CROSS

35 End Sub

Details show this:

System.InvalidOperationException

HResult=0x80131509

Message=Application-defined or object-defined error.

Source=WinFormsApp1

StackTrace:

at WinFormsApp1.My.MyProject.MyForms.Create__Instance__T in :line 192

at WinFormsApp1.My.MyProject.MyForms.get_Form1()

at WinFormsApp1.My.MyApplication.OnCreateMainForm() in D:\TEABAG_SOFTWARE\Ganswind\Ganswind\WinFormsApp1\My Project\Application.Designer.vb:line 34

at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()

at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()

at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)

at WinFormsApp1.My.MyApplication.Main(String[] Args) in :line 83

This exception was originally thrown at this call stack:

[External Code]

Inner Exception 1:

NullReferenceException: Object reference not set to an instance of an object.

I have no idea where to look in the code for the problem?

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,903 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.