This simple code prevent application from closing
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Thread TH = new Thread(Run);
TH.Start();
}
void Run()
{
Application.Run();
}
On the other hand i can stop this with:
Application.Exit();
But, this does not work with when [X] button on Form is pressed, the Debugging still working, and the console debug output gives me this, while Form is actually closed:
The thread 0x65c has exited with code 0 (0x0).
The thread 0x11c0 has exited with code 0 (0x0).
Any Idea how to actually stop this totally with [X] button?
Ok, I managed to fix it.
in Form1.Designer.cs inside
InitializeComponent()this needs to be added
then in Form1.cs