Results 1 to 3 of 3

Thread: Pop up form on closing

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Pop up form on closing

    I have been requested to add a pop up form when the user chooses to quit the application.
    The form needs to stay visible until the application is finished with all its clean up code and then close down.

    Can anyone point me in the right direction as when it comes down to threading I really suck.

    Thanks In Advance

    Parksie

  2. #2
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: Pop up form on closing

    Why don't you disable the cose_event when the procedure is still running, or create a messagebox when trying to close the form? Think that would be the best/most easy solution.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

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

    Re: Pop up form on closing

    Untested:
    vb.net Code:
    1. Private f As Form
    2.  
    3. Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    4.     Call New Thread(AddressOf ShowF).Start()
    5. End Sub
    6.  
    7. Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
    8.     f.Invoke(New MethodInvoker(AddressOf f.Close))
    9. End Sub
    10.  
    11. Private Sub ShowF()
    12.     Me.f = New Form
    13.  
    14.     f.Show()
    15. End Sub
    It would be more appropriate to use the application's Shutdown event than the form's FormClosed event but you get the idea. Very easy so maybe having a go yourself would have been worth a try.
    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