Unhandled Exception is thrown 
Author Message
 Unhandled Exception is thrown


I have a very big problem, I hope someone can help me!

I have a vb.net application with multiple forms and sharing one module. All
"global" variables are declared in the form.

Here is the problem: When randomly installing the application, some machines
work fine, but others generate an unhandle exception of type
system.typeinitializationexception. I've tried catching the error in the sub
main() but nothing.

Is there a way I can catch any exception and not show the "unhandled
exception dialog box".

Thanks in advance,

Randy F.

Wed, 07 Sep 2005 01:20:00 GMT  
 Unhandled Exception is thrown
Hello Randy,

> Is there a way I can catch any exception and not show the "unhandled
> exception dialog box".

Maybe this helps (untested):

AddHandler Application.ThreadException, AddressOf ErrorHandler
Private Sub ErrorHandler( _
    ByVal sender As Object, _
    ByVal e As System.Threading.ThreadExceptionEventArgs _
    Debug.WriteLine("Fehler: " & e.Exception.Message)
End Sub

-- or --

Public Sub Main()
        Application.Run(New Form1())
    Catch ex As Exception
    End Try
End Sub

You must add the following code to your <Appname>.exe.config file or the

  <system.windows.forms jitDebugging="true" />

Herfried K. Wagner

Wed, 07 Sep 2005 03:03:09 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Unhandled Exception Err MSAcc97

2. Unhandled exception in Visdata.exe(rpcrt4.dll)

3. VBScript "Unhandled Exception" MSO9.DLL W2k

4. Return from unhandled exceptions after Application.ThreadException event

5. Unhandled exception error

6. Getting unhandled exception error with WNetOpenEnum

7. Unhandled exception vb.net

8. Unhandled exception in system.windows.forms.dll (in my main form) - argh

9. The F2 shortcut key causes an unhandled exception in the datagrid

10. DataGrid Unhandled Exception

11. Unhandled exception

12. Deploying on XP with .Net Framework sp2 security exception unhandled


Powered by phpBB® Forum Software