End application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?=

    #1

    End application

    Hi,

    I would like to be able to end my application when pushing a button. Like
    the X in the upper right corner. How is this done. How do I send end app
    event?

    regards Jesper.
  • zacks@construction-imaging.com

    #2
    Re: End application

    On Oct 2, 6:58 am, Jesper, Denmark
    <JesperDenm...@ discussions.mic rosoft.comwrote :
    Hi,
    >
    I would like to be able to end my application when pushing a button. Like
    the X in the upper right corner. How is this done. How do I send end app
    event?
    >
    regards Jesper.
    Depends. Assuming you are asking about a standard Windows Application
    project. If the current code path is the main form, then just create a
    command button control and in the Click event handler just do a:

    this.Close();

    If you are in a child form or dialog window, you will need to send
    this information back to the main form. Closing the main form shuts
    down the app.

    Comment

    • Nicholas Paldino [.NET/C# MVP]

      #3
      Re: End application

      Or, you can just call the static Exit method on the Application class,
      which will send a WM_QUIT message to the main window and cause it to shut
      down. This can be done from anywhere.

      --
      - Nicholas Paldino [.NET/C# MVP]
      - mvp@spam.guard. caspershouse.co m

      <zacks@construc tion-imaging.comwrot e in message
      news:1191331902 .338546.30900@n 39g2000hsh.goog legroups.com...
      On Oct 2, 6:58 am, Jesper, Denmark
      <JesperDenm...@ discussions.mic rosoft.comwrote :
      >Hi,
      >>
      >I would like to be able to end my application when pushing a button. Like
      >the X in the upper right corner. How is this done. How do I send end app
      >event?
      >>
      >regards Jesper.
      >
      Depends. Assuming you are asking about a standard Windows Application
      project. If the current code path is the main form, then just create a
      command button control and in the Click event handler just do a:
      >
      this.Close();
      >
      If you are in a child form or dialog window, you will need to send
      this information back to the main form. Closing the main form shuts
      down the app.
      >

      Comment

      • Ignacio Machin \( .NET/ C# MVP \)

        #4
        Re: End application

        Hi,

        "Jesper, Denmark" <JesperDenmark@ discussions.mic rosoft.comwrote in message
        news:BB5C488C-6CAD-4B01-83A1-273F294C115A@mi crosoft.com...
        Hi,
        >
        I would like to be able to end my application when pushing a button. Like
        the X in the upper right corner. How is this done. How do I send end app
        event?
        The Applicacion class has a method that let you do it.
        Application.Exi t will do it


        Comment

        • =?Utf-8?B?S2lt?=

          #5
          RE: End application

          Hej Jesper

          Make a button Form1 object and write this.Close(); were "this" this is Form1
          object
          If I have read the questen right its work. .NET will activate the cloce
          procidure for X in upper right corner

          Regards

          Kim S.


          "Jesper, Denmark" wrote:
          Hi,
          >
          I would like to be able to end my application when pushing a button. Like
          the X in the upper right corner. How is this done. How do I send end app
          event?
          >
          regards Jesper.

          Comment

          Working...