Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. Public Class SplashFrm
  2.  
  3. Private WithEvents DoSomeWork As ValidateCls
  4. Private Sub SplashFrm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  5. Me.Show()
  6. DoSomeWork = New ValidateCls
  7. Application.DoEvents()
  8. DoSomeWork.doWorks()
  9. End Sub
  10. Private Sub React() Handles DoSomeWork.WorkFinished
  11. LoginFrm.Show()
  12. Me.Close()
  13. End Sub
  14.  
  15. End Class
  16.  
  17.  
  18. Public Class ValidateCls
  19. Public Event WorkFinished()
  20.  
  21. Sub doWorks()
  22. AddHandler System.AppDomain.CurrentDomain.UnhandledException, AddressOf OnUnhandledException
  23. Try
  24. 'here code to validate licenses.
  25. 'i can not put the code, but it works fine because I can see that is validating ok.
  26. Catch ex As Exception
  27. SaveError("ValidateCls-1", ex.ToString)
  28. End
  29. End Try
  30. RaiseEvent WorkFinished()
  31. End Sub
  32.  
  33. Private Sub OnUnhandledException(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
  34. Try
  35. HandleUnhandledException(e.ExceptionObject)
  36. Catch ex As Exception
  37.  
  38. End Try
  39. End Sub
  40.  
  41. Private Sub HandleUnhandledException(ByVal o As Object)
  42. If o Is Nothing Then Return
  43. Try
  44. Dim e As Exception = DirectCast(o, Exception)
  45. MessageBox.Show(e.StackTrace, "Unhandled exception.")
  46. Catch ex As Exception
  47. MessageBox.Show(ex.Message, "Unhandled exception.")
  48. Finally
  49. Application.Exit()
  50. End Try
  51. End Sub
  52.  
  53. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement