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
  1. Home
  2. General Programming
  3. C#
  4. To exit application

To exit application

Scheduled Pinned Locked Moved C#
help
12 Posts 3 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.
  • N Nekshan

    private void button1_Click(object sender, EventArgs e) { conn.Open(); System.Windows.Forms.Form login_ = new login(); login_.Show(); if (login_.Close()) { Application.Exit(); } conn.Close(); } i m opening this form 'Login' on button click n then if i close this form by clicking on close button, application itself must also stop running automatically. As even if i close all forms the application keeps on running till i stop it myself. Plz help on it. Thank You. -- modified at 1:13 Monday 19th February, 2007

    V Offline
    V Offline
    virendra patel
    wrote on last edited by
    #3

    first remove this If (login_.Close()) Then { Application.Exit(); } one prob solve.

    N 1 Reply Last reply
    0
    • V virendra patel

      first remove this If (login_.Close()) Then { Application.Exit(); } one prob solve.

      N Offline
      N Offline
      Nekshan
      wrote on last edited by
      #4

      but after i logout, this login form is shown again, now if i close this login form from close button, application must also end automatically,which is not ending till i stop it myself. how to do it? AND i want to access 'url' of current datetime. "select url from tblsummary where accessdate = " + DateTime.Now; this is giving error. thanx. nekshan.

      V 1 Reply Last reply
      0
      • N Nekshan

        but after i logout, this login form is shown again, now if i close this login form from close button, application must also end automatically,which is not ending till i stop it myself. how to do it? AND i want to access 'url' of current datetime. "select url from tblsummary where accessdate = " + DateTime.Now; this is giving error. thanx. nekshan.

        V Offline
        V Offline
        virendra patel
        wrote on last edited by
        #5

        "select url from tblsummary where accessdate = '" + DateTime.Now + "'" now work.

        1 Reply Last reply
        0
        • N Nekshan

          private void button1_Click(object sender, EventArgs e) { conn.Open(); System.Windows.Forms.Form login_ = new login(); login_.Show(); if (login_.Close()) { Application.Exit(); } conn.Close(); } i m opening this form 'Login' on button click n then if i close this form by clicking on close button, application itself must also stop running automatically. As even if i close all forms the application keeps on running till i stop it myself. Plz help on it. Thank You. -- modified at 1:13 Monday 19th February, 2007

          V Offline
          V Offline
          virendra patel
          wrote on last edited by
          #6

          lunch time. bye..after 1 hr.

          1 Reply Last reply
          0
          • N Nekshan

            private void button1_Click(object sender, EventArgs e) { conn.Open(); System.Windows.Forms.Form login_ = new login(); login_.Show(); if (login_.Close()) { Application.Exit(); } conn.Close(); } i m opening this form 'Login' on button click n then if i close this form by clicking on close button, application itself must also stop running automatically. As even if i close all forms the application keeps on running till i stop it myself. Plz help on it. Thank You. -- modified at 1:13 Monday 19th February, 2007

            V Offline
            V Offline
            virendra patel
            wrote on last edited by
            #7

            if u want to close application on close button then write this code on close button click Application.Exit();

            1 Reply Last reply
            0
            • N Nekshan

              private void button1_Click(object sender, EventArgs e) { conn.Open(); System.Windows.Forms.Form login_ = new login(); login_.Show(); if (login_.Close()) { Application.Exit(); } conn.Close(); } i m opening this form 'Login' on button click n then if i close this form by clicking on close button, application itself must also stop running automatically. As even if i close all forms the application keeps on running till i stop it myself. Plz help on it. Thank You. -- modified at 1:13 Monday 19th February, 2007

              V Offline
              V Offline
              virendra patel
              wrote on last edited by
              #8

              write above reply mail on close button of login page. and replay me

              N 2 Replies Last reply
              0
              • V virendra patel

                write above reply mail on close button of login page. and replay me

                N Offline
                N Offline
                Nekshan
                wrote on last edited by
                #9

                gng for lunch. tell u later. nekshan

                1 Reply Last reply
                0
                • V virendra patel

                  write above reply mail on close button of login page. and replay me

                  N Offline
                  N Offline
                  Nekshan
                  wrote on last edited by
                  #10

                  Arey, 'close' is not my button, it is the form close button on top right side with minimize n restore buttons.

                  V 1 Reply Last reply
                  0
                  • N Nekshan

                    Arey, 'close' is not my button, it is the form close button on top right side with minimize n restore buttons.

                    V Offline
                    V Offline
                    virendra patel
                    wrote on last edited by
                    #11

                    Private Sub formName_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Application.Exit(); End Sub this is the even of form this is called at the time of form closing. ok and formName is the name of form.

                    N 1 Reply Last reply
                    0
                    • V virendra patel

                      Private Sub formName_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Application.Exit(); End Sub this is the even of form this is called at the time of form closing. ok and formName is the name of form.

                      N Offline
                      N Offline
                      Nekshan
                      wrote on last edited by
                      #12

                      thanx, yes it is working. take care. cu

                      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