application-close

Gracefully closing multithreading application?

I have an application that has two threads. The first one (the main thread) that captures the data using socket and update DataTables The second Inserts the DataTables into the database. The application works fine but when it closes, the main thread finishes reading the data and call Abort method in the second thread, which may be ins...

C# application closing problem.

I want my application such that, it will minimize to System Tray on clicking the close(X) button. And it will only be closed by clicking a different button/menu on the main application window or clicking a system tray context menuItem. I am able to make the window minimize to tray on close. But the problem I am facing is, I am now una...

Task manager close is not detected second time in a WinForms Application

private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { if (MessageBox.Show(this, "Do you really want to close?", "Close?", MessageBoxButtons.YesNo) == DialogResult.No) { e.Cancel = true; } } } So...

C# disable Alt+F4 but allow the the form to be closed by code, CloseReason.UserClosing is not helping.

Hi, I want that the form will not close by doing Alt+F4 but if Application.Exit() or this.Close is called from the same Form, it should be closed. I tried CloseReason.UserClosing but still no help. ...