Click here to Skip to main content
15,925,723 members
Home / Discussions / C#
   

C#

 
GeneralRe: Naming Convention Pin
7-Feb-02 15:33
suss7-Feb-02 15:33 
GeneralRe: Naming Convention Pin
James T. Johnson7-Feb-02 17:38
James T. Johnson7-Feb-02 17:38 
GeneralRe: Naming Convention Pin
paulb7-Feb-02 17:54
paulb7-Feb-02 17:54 
GeneralRe: Naming Convention Pin
James T. Johnson7-Feb-02 18:45
James T. Johnson7-Feb-02 18:45 
GeneralRe: Naming Convention Pin
Senkwe Chanda11-Feb-02 2:16
Senkwe Chanda11-Feb-02 2:16 
GeneralRe: Naming Convention Pin
James T. Johnson11-Feb-02 16:39
James T. Johnson11-Feb-02 16:39 
GeneralRe: Naming Convention Pin
Peter Stephens8-Feb-02 7:44
Peter Stephens8-Feb-02 7:44 
Generaltrying to prevent user from exiting the application sometimes Pin
7-Feb-02 6:59
suss7-Feb-02 6:59 
There are times in my application that I want to prevent the user from exiting the application window with the exit button (the X button in the upper right hand corner of most window applications).

I want in some circumstances to print out a message box and to let the user know that the application is in a state that cannot exit the application and to keep it running.

The following code catches that application exiting from clicking on the exit button, and prints out the message box. But how can I stop the application from continuing with the exit ?

Actually, by the time the message box is printed, the application window is already closed.

I am fairly new at C #, any help is appreciated.

static void Main(string [] args)
{
Application.ApplicationExit += new EventHandler(ApplicationExitEventHandler);
Application.Run(new CsMain());
}

static void ApplicationExitEventHandler(Object sender, System.EventArgs e)
{
if (state != CLOSED_STATE)
{
MessageBox.Show("Error ! \n\nThe line is still open. You must close the \nline before terminating the application", "CsTdrv", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}

}


GeneralRe: trying to prevent user from exiting the application sometimes Pin
7-Feb-02 13:01
suss7-Feb-02 13:01 
GeneralWindows Form Help Application Pin
kyledunn7-Feb-02 1:39
kyledunn7-Feb-02 1:39 
GeneralVisio with c# Pin
6-Feb-02 23:04
suss6-Feb-02 23:04 
GeneralShow ContextMenu in Node Pin
thongkk6-Feb-02 14:51
thongkk6-Feb-02 14:51 
GeneralRe: Show ContextMenu in Node Pin
Schnemar7-Mar-02 4:38
Schnemar7-Mar-02 4:38 
GeneralRe: Show ContextMenu in Node Pin
thongkk7-Mar-02 14:26
thongkk7-Mar-02 14:26 
GeneralWin9x Pin
woodcarver6-Feb-02 11:41
woodcarver6-Feb-02 11:41 
GeneralRe: Win9x Pin
9-Feb-02 5:47
suss9-Feb-02 5:47 
GeneralIP Address in .NET Pin
Joe Folger6-Feb-02 10:07
Joe Folger6-Feb-02 10:07 
GeneralRe: IP Address in .NET Pin
Joe Folger6-Feb-02 11:06
Joe Folger6-Feb-02 11:06 
Generalproblems getting a timer to work Pin
6-Feb-02 8:32
suss6-Feb-02 8:32 
GeneralRe: problems getting a timer to work Pin
James T. Johnson6-Feb-02 10:39
James T. Johnson6-Feb-02 10:39 
GeneralRe: problems getting a timer to work Pin
7-Feb-02 5:50
suss7-Feb-02 5:50 
QuestionHow to call a C# Dll from C++ ?? Pin
6-Feb-02 5:03
suss6-Feb-02 5:03 
AnswerRe: How to call a C# Dll from C++ ?? Pin
James T. Johnson6-Feb-02 11:17
James T. Johnson6-Feb-02 11:17 
GeneralRe: How to call a C# Dll from C++ ?? Pin
9-Feb-02 3:00
suss9-Feb-02 3:00 
GeneralRe: How to call a C# Dll from C++ ?? Pin
James T. Johnson9-Feb-02 18:50
James T. Johnson9-Feb-02 18:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.