Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.96 KB | None | 0 0
  1. module modMain
  2.     Function main(ByVal cmdargs() As String) As Integer
  3.         Dim lbLocal As Boolean = False ' toggle me !
  4.         Try
  5.             If lbLocal Then
  6.                 'Local test: generate error within main()
  7.                 Dim liI As Long = CLng(1 / liI)
  8.             Else
  9.                 'Form test: generates error under button's event
  10.                 Dim goFrm As frmMain
  11.                 goFrm = New frmMain
  12.                 goFrm.ShowDialog()
  13.             End If
  14.  
  15.         Catch ex As Exception
  16.             ' This is not fired when lbLocal=FALSE in RELEASE version, but is fired in DEBUG version
  17.             MsgBox(ex.ToString)
  18.         End Try
  19.  
  20.         Return 0
  21.  
  22.     End Function
  23. end module
  24.  
  25. Public Class frmMain
  26.  
  27.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  28. ' Generates an error under button click event
  29.         Dim liI As Long = CLng(1 / liI)
  30.     End Sub
  31. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement