Don't catch exceptions from a form opened in diferent Thread (VB.Net 2015)

  • Thread starter Thread starter CM16
  • Start date Start date
C

CM16

Guest
Hi, thanks for your attention.
I have a form (fmPrincipal) where i show the main menu of my system. In there i have a button to open the list of logged users of my system (fmUsers). I have a thread to show the form of users, the code to open this this:

Sub OpenWindows ()
Try
Dim th As System.Threading.Thread = New Threading.Thread(AddressOf AbrirFormNuevo)
th.SetApartmentState(ApartmentState.STA)
th.Start()
Catch ex As Exception
MsgBox(ex)
End Try
End Sub


Public Sub AbrirFormNuevo()
Try
Application.Run(fmUsers)
Catch ex As Exception
RegistrarLogEventos("Metodo:AbrurFormNuevo[menu principal]:" & ex.Message)
End Try
End Sub


The problem is that i can't catch the exceptions of the fmUsers. I would gratefully so much if someone can helpme.
Regards.

Continue reading...
 
Back
Top