Results 1 to 14 of 14

Thread: How I close my appication?

  1. #1

    Thread Starter
    Lively Member angel of dark's Avatar
    Join Date
    Dec 2002
    Location
    Leon guanajuato Mexico
    Posts
    74

    How I close my appication?

    I want to close my application from one button, does any one knows how to do it??

    like in visual basei you use

    VB Code:
    1. End

    thanks
    Last edited by angel of dark; May 20th, 2003 at 11:35 PM.
    al peor programador hasta el HELLO WORLD le marca error.....

    event to the worst programmer the Hello world marks him error..

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Application.Close()

  3. #3

    Thread Starter
    Lively Member angel of dark's Avatar
    Join Date
    Dec 2002
    Location
    Leon guanajuato Mexico
    Posts
    74
    It doesn´t works I wrote Application.Close(); also I try with the name of the name of the application in this case is "Sale" so I wrote Sale.Close(); and It didn´t works either, could you help me??, or maybe you know a way to reload an application.

    Cheers
    al peor programador hasta el HELLO WORLD le marca error.....

    event to the worst programmer the Hello world marks him error..

  4. #4
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Try this

    Me.Close()

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by angel of dark
    It doesn´t works I wrote Application.Close(); also I try with the name of the name of the application in this case is "Sale" so I wrote Sale.Close(); and It didn´t works either, could you help me??, or maybe you know a way to reload an application.
    Cheers
    What do you mean it didn't work ? the code DevGrp posted should work regardless of where it is used (startup form or nested form)

  6. #6
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    angel of dark: You don't need to use the name of the application. Just use "Application.Close();" No matter the name. "Sale.Close()" will never work.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Tec-Nico
    "Sale.Close()" will never work.
    This will work if "Sale" is the startup form of the project .

  8. #8
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    True, but I know the case, and "Sale" is the name of the project, not the name of the startup form, Pirate.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  9. #9
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    "Application.Close()" won't work on other forms... But I found out that "Application.Exit()" does.

    So I wrote on the Closed event "Application.Exit()" and it forces the End of your application like "End" of Visual Basic.

    Example:


    private void frmLogin_Closed(object sender, System.EventArgs e)
    {
    Application.Exit();
    }
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  10. #10
    Addicted Member zahadumy's Avatar
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    187

    Re: How I close my appication?

    Application.Exit() will close your application, but if you have any running threads they will continue to run, this doesn't take care about threads. But that's true in VB too...
    Hope this helps.
    The first step in solving a problem is to define the problem clearly.

    -----
    Icons | EZIconConverter | Popup Messages
    101 samples: 2003 2005
    Code converter: C# -> VB .NET | VB .NET -> C# | VB .NET <-> C#


    -----
    Visual Studio 2005/.NET Framework 2.0

  11. #11
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: How I close my appication?

    Application.Close closes the application but still runs in the background
    Application.Exit closes and exits the application....I am sure that if there are threads still running then a threadAbortException will be thrown which you would have to handle....

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  12. #12
    Addicted Member zahadumy's Avatar
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    187

    Re: How I close my appication?

    Quote Originally Posted by Techno
    Application.Exit closes and exits the application....I am sure that if there are threads still running then a threadAbortException will be thrown which you would have to handle....
    I am sure if there are threads still running they will continue to run if you don't stop them programatically.
    The first step in solving a problem is to define the problem clearly.

    -----
    Icons | EZIconConverter | Popup Messages
    101 samples: 2003 2005
    Code converter: C# -> VB .NET | VB .NET -> C# | VB .NET <-> C#


    -----
    Visual Studio 2005/.NET Framework 2.0

  13. #13
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How I close my appication?

    Quote Originally Posted by zahadumy
    Application.Exit() will close your application, but if you have any running threads they will continue to run, this doesn't take care about threads. But that's true in VB too...
    Hope this helps.
    Did you look at the last post date in this thread before posting?

  14. #14
    Addicted Member zahadumy's Avatar
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    187

    Re: How I close my appication?

    05-24-2003

    Oops... I just saw 05.24, which would be like a week ago in this year, I didn't look at the year. Anyway, I thought I found this thread on the first page, probably I was searching for something else and found it. Sorry.
    The first step in solving a problem is to define the problem clearly.

    -----
    Icons | EZIconConverter | Popup Messages
    101 samples: 2003 2005
    Code converter: C# -> VB .NET | VB .NET -> C# | VB .NET <-> C#


    -----
    Visual Studio 2005/.NET Framework 2.0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width