Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. ALT+F4

ALT+F4

Scheduled Pinned Locked Moved C#
helpquestionworkspace
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ronni Marker
    wrote on last edited by
    #1

    Hello Gents. Am trying to alter the way ALT+F4 closes an application and hope I can get some guru help here. I have a component that calls an Windows form for a regstration page. On that Windows form I have two buttons. One closes the application by: System.Environment.Exit(); and the other button closes the application by: System.Enviroment.Exit(-1); The first only closes the form that runs inside the component, the later closes the whole application including what ever application who calls the component. Now my problem is that when the form that opens inside the compoent is active and a user hits ALT+F4, then the only the component closes and not the whole application. To me it seems that a standard ALT+F4 is like invoking System.Environment.Exit() and not System.Enviroment.Exit(-1). Is there any way I can force ALT+F4 to close the whole application like System.Enviroment.Exit(-1) does? Cheers, Ronni

    R 1 Reply Last reply
    0
    • R Ronni Marker

      Hello Gents. Am trying to alter the way ALT+F4 closes an application and hope I can get some guru help here. I have a component that calls an Windows form for a regstration page. On that Windows form I have two buttons. One closes the application by: System.Environment.Exit(); and the other button closes the application by: System.Enviroment.Exit(-1); The first only closes the form that runs inside the component, the later closes the whole application including what ever application who calls the component. Now my problem is that when the form that opens inside the compoent is active and a user hits ALT+F4, then the only the component closes and not the whole application. To me it seems that a standard ALT+F4 is like invoking System.Environment.Exit() and not System.Enviroment.Exit(-1). Is there any way I can force ALT+F4 to close the whole application like System.Enviroment.Exit(-1) does? Cheers, Ronni

      R Offline
      R Offline
      Ronni Marker
      wrote on last edited by
      #2

      Found the answer... private void form1_FormClosing (object sender, FormClosingEventArgs e) { if (e.CloseReason != CloseReason.ApplicationExitCall) { System.Environment.Exit (-1); } }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups