Ending program execution 
Author Message
 Ending program execution

I have written a program that on Form Load, goes and searches for a
file. If the file is found, everything works fine - including my Exit
button which does nothing but End.

However, if the file I'm looking for isn't found, (in the Form Load),
I can't seem to get the program to quit.

I should clarify, that everything works fine while I am in the
development environment, but when I turn it into an EXE, it won't quit
(when the file I'm looking for isn't found). When this happens, the
Exit button won't work either. Clicking Cancel closes the window, but
the program still shows up in the task manager.

I have tried both End and Return (same result)

Anyone have any ideas?



Fri, 28 Mar 2003 11:16:58 GMT  
 Ending program execution
Hi, I don't know the reason, but I've read anywhere that you have to end a
program like this :

Private Sub Form_Unload(Cancel As Integer)
    UnloadAllForms
End Sub

Public Sub UnloadAllForms()
Dim Form As Form
   For Each Form In Forms
      Unload Form
      Set Form = Nothing
   Next Form
End Sub

Hope it helps,
Leo



Fri, 28 Mar 2003 14:04:13 GMT  
 Ending program execution

My hunch is that your program is looping in an Error Handler, but it
is hard to be sure without looking at the code.

You need to note that in development mode the default path is to the
VB directory, and in compiled mode it is the directory from which the
EXE was loaded (usually) - best to *always* use App.Path rather than
let VB decide the path.

Quote:

>I have written a program that on Form Load, goes and searches for a
>file. If the file is found, everything works fine - including my Exit
>button which does nothing but End.

>However, if the file I'm looking for isn't found, (in the Form Load),
>I can't seem to get the program to quit.

>I should clarify, that everything works fine while I am in the
>development environment, but when I turn it into an EXE, it won't quit
>(when the file I'm looking for isn't found). When this happens, the
>Exit button won't work either. Clicking Cancel closes the window, but
>the program still shows up in the task manager.

>I have tried both End and Return (same result)

>Anyone have any ideas?



Fri, 28 Mar 2003 14:28:47 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. determining if a shelled program has ended execution (vb3.0)

2. END Statement doesn't end program!

3. At wits end..formula execution

4. ending a DOS shell after execution

5. End VBScript Execution

6. VB5 crashes under W2K after ending execution

7. (2nd Post) BASIC programming advice needed: PKWARE'S compression utilities front end application - PROGRAMMING PROJECT

8. Help - Module Execution in another program

9. Pausing program execution

10. Displaying Cursor during program execution

11. CA-Realizer program execution speed problem !!!

12. Count Program Executions

 

 
Powered by phpBB® Forum Software