CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    47

    Closing an Application

    I have an application that has one form you can call from the start up form (not sure if this is important but thought I would mention it) - It seems that when I close the application it is somehow still running when I view the processes in the Windows NT 4.0 Task Manager.

    Is there anyway I can close an application completely????

    Thank You


  2. #2
    Join Date
    Apr 1999
    Posts
    45

    Re: Closing an Application

    So your project has 2 forms. What is going on is that when you terminate the application from your second form ... the startup form is still in memory. There are several ways to allievate this problem. If you don't need to go back to your startup form ever ... just unload it when you show the 2nd form (UnLoad frmStartup). If you are switching back from form to form, you need to unload the other form in each forms unload event. For example in the 2nd forms Unload Event you need to put the following line of code, Unload frmStartup, and in frmStartup's Unload event ... UnLoad frmMyOtherForm. Or, instead of putting this code in the Unload event, you can really be slick and put the following code in both of the forms QueryUnload event

    Dim mess As Integer
    If UnloadMode = 0 Then
    mess = MsgBox("Do You Really Want to Quit?", vbQuestion + vbYesNo + vbDefaultButton2, Me.Caption)
    If mess = vbNo Then
    Cancel = True
    Else
    Unload frmWhatever ' the other form in the project
    End If
    End If

    Gordito


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

Featured