main exception doesn't work outside IDE

Semola

Member
Joined
Aug 27, 2018
Messages
6
Programming Experience
3-5
Hi All,

I have a problem with a "try catch" code in my program:

In the main module I have inserted this code:

VB.NET:
Try
    Application.EnableVisualStyles()
    Application.VisualStyleState = VisualStyles.VisualStyleState.ClientAndNonClientAreasEnabled
    Application.Run(New frmMovieDatabase)
catch ex as exception
    My.Computer.FileSystem.DeleteDirectory(ws_temp_path, FileIO.DeleteDirectoryOption.DeleteAllContents)
    MsgBox(Utility.PadCenter("Si è verificato un errore", 30) & Chr(10) & Chr(13) & Utility.PadCenter("Il programma termina", 30))
    ws_log.ScriviEx(ex)
    ws_log.Dispose()
    System.Environment.Exit(-1)
end try

This code force to quit program immediately if I don't catch an exception in the frmMovieDatabase form and write it in the trace

This code works perfectly in the visual studio IDE, but executing the program outside the IDE (Also like adminstrator), doesn't work.

Did I forget something in the code I indicated?

Anyone can help me?

Thanks

Semola
 
Last edited by a moderator:
Back
Top