How to not exit app after Main() in Module is run ?? ( 7 Views )

no kitty!
  1. I have a solution that is initially running the Main() routine in a Module, but after is had run that code it exits the application. how can I stop it doing this, cos its putting the icon into the system stray where I want it, but I cant get it to just idle there :S

    (merve, Yemen)

  2. You would need to override the forms "Closing" event and set the Cancel value to true. See below:

    privatevoid OnWizardClosing( object sender, System.ComponentModel.CancelEventArgs e )
    {
    // Cancel the Closing event from closing the form
    e.Cancel = true;
    }
    Good luck...

    (deliyar, Sweden)

  3. Don't forget to add in a flag to catch when you do want the app to close.

    Also note that doing this means windows cannot close your app cleanly, but will instead show the "End Task" alert. I'm not sure how to catch a windows event trying to close your app

    (cemre , Uzbekistan)

  4. If you want an icon in the system tray, you want the program still running, no? So it should not be exiting the main routine.

    WWB

    (burcu, Brunei Darussalam)

  5. You can catch that by setting a dirty bit.......

    privatebool m_IsDirty = false;

    // Override the cancel clickprivatevoid wizard_CancelButtonClick(object sender, System.EventArgs e)
    {
    this.Close();
    }

    // Set the dirty bit to determine if the window should be closed
    privatevoid SetDirty( bool dirty )
    {
    m_IsDirty = dirty;
    }

    // Handles the closing of the window

    privatevoid OnWizardClosing(object sender, System.ComponentModel.CancelEventArgs e)
    {
    if ( !CloseDocument() )
    e.Cancel =
    true;
    }
    // Perform any action you wish to do here
    privatebool CloseDocument()
    {
    if ( !m_IsDirty ) returntrue;
    .....
    }

    This can be shortened a bit but this should give you a pretty good idea of how to create one to fit your needs....

    (berfin, French Polynesia)

  6. I have never used C# before. I tried using similar type code in VB.NET to do the same sort of job but it doesnt seem to work. Is anyone able to convert that to VB code for me ??

    Thanks for the effort SWAT, much appreciated :)

    (ömer, Cameroon)


  7. (emre, Solomon Islands)



Related Topics ... (or search in 1.720.883 topics !)

built-in module, dynamic module, or stand-alone app? (5)
close button.. exit app? (2)
permission system for module based web-app (11)
run on page exit (5)
using app::main() instead of global namespace? (23)
cant run more than 1 memory module (13)
php is run as a cgi module? (4)
can't get php to run with apache (as a module) (14)
how to run a dos app (7)




copyright © 2007-2031 Pfodere.COM ( 7 Pfoyihuee Online )

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
1.3472