What happens if form does not unload?


I am new to VB6 and cannot find anything about my question in a book or the web.

I have a button on a windows form named "Finished" when pressed it calls the method
cmdOk_Click shown below.

Mostly this is a question about logic. In the code stub below if the subroutine
call to "SaveSuccesful" returns a true value then the "Unload Me" is executed.

So if it is Not executed then what happens? Does the windows form just stay open?



Private Sub cmdOK_Click()
  If (SaveSuccesful) Then _
  Unload Me
End Sub
LVL 2
brgdotnetcontractorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MattiCommented:
Hi!

Your program stays in memory.

Try this when you end your program:
Dim aForm As Form
For Each aForm In Forms
Unload aForm
Next

Regards!
Matti
0
SriVaddadiCommented:
Yes. it remains. it remains in memory if u hide it or window is available visible
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VBClassicGuyCommented:
If I understand you correctly, in your exit routine I would give user a choice, or you'll never exit the program unlees the save is successful. Try:
Private Sub cmdOK_Click()
   Dim booSuccess As Boolean
   
Retry:
   booSuccess = SaveSuccesful()
   
   If booSuccess Then
      Unload Me
   Else
      Select Case MsgBox("Save failed!", vbAbortRetryIgnore, "ERROR")
         Case 3
            Rem *** Abort ***
            Exit Sub
         Case 4
            Rem *** Retry ***
            GoTo Retry
         Case 5
            Rem *** Ignore ***
            Unload Me
      End Select
   End If
   
End Sub
0
brgdotnetcontractorAuthor Commented:
Actually Srivadi had the best answer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.