After creating a Windows Form project I added Close(); after InitializeComponent(); in the constructor. When I run the project, i get the following error:
Make sure you have not released a resource before attempting to use it
The error happens in the Program.cs file.
My real code at work is a bit more complicated, what I'm doing is authenticating a user against a table and then trying to close to form if they're not in the table. But the functions I call are called from the constructor, and the error is the same error in the same place. I'd like to know how to close the form from the constructor, other than sinking the error. I'm concerned that there may be a memory leak.