Results 1 to 5 of 5

Thread: how to end the process when i close my window

  1. #1

    Thread Starter
    Member
    Join Date
    May 2007
    Posts
    60

    how to end the process when i close my window

    hi
    i am using a server that remain working when i close the window
    Please , how to stop the process
    Thank you

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: how to end the process when i close my window

    There are really only two reasons that your process wouldn't exit:

    1. You have hidden a form instead of closing it.

    2. You have a second foreground thread running.

    Which is it in your case?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    May 2007
    Posts
    60

    Re: how to end the process when i close my window

    No i press the X button , but the process keeps working
    maybe because i have a server / client form
    is there a property for the form to close it with the process
    i thought about making a button that contain Me.close , but this is not working !

  4. #4
    Hyperactive Member
    Join Date
    May 2008
    Location
    >> ( ҉ )
    Posts
    413

    Re: how to end the process when i close my window

    vb Code:
    1. Public Class Form1
    2.  
    3.     Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    4.         Form1.Close()
    5.         Form2.Close()
    6.         Form3.Close()
    7.         Form4.Close()
    8. 'Your other forms.'
    9.     End Sub
    10. End Class

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: how to end the process when i close my window

    Quote Originally Posted by saadmechiche View Post
    No i press the X button , but the process keeps working
    maybe because i have a server / client form
    is there a property for the form to close it with the process
    i thought about making a button that contain Me.close , but this is not working !
    As I've explained, there are really only two reasons that your app wouldn't be closing. There is no property that is stopping it closing that you can change to fix it. The problem is that you either have hidden a form instead of closing it or else you have another foreground thread running.

    What is the shutdown mode of your app set to in the project properties and exactly what forms do you use and how? Do you maybe have a login form as your startup form that you then hide instead of closing to stop the app shutting down straight away? Something like that?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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