Dim Code As String
Code = "try" & vbcrlf
Code = Code & "Dim Val1 As Integer = 1" & vbcrlf
Code = Code & "Dim Val2 As Integer = 0" & vbcrlf
Code = Code & "Dim Sum As Integer = Val1 / Val2" & vbcrlf
Code = Code & "Return Sum" & vbcrlf
Code = Code & "Catch ex As Exception" & vbcrlf
Code = Code & "msgbox(ex.message)" & vbcrlf
Code = Code & "return -1" & vbcrlf
Code = Code & "end try"
Output.Show(code)
Functions.remove("Sum")
Functions.Add("Sum",Code)
Functions.Complie()
Dim a = Functions.Execute("Sum")
If a = -1 Then
msgbox("出错")
End If