Imports PaxScript.Net Public Class Form1 Inherits System.Windows.Forms.Form Friend WithEvents Button1 As System.Windows.Forms.Button Friend scripter As PaxScripter = New PaxScripter #Region " Windows Form Designer generated code " '........................................................ #End Region Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click scripter.Reset() scripter.AddModule("1", "VB") scripter.AddCodeLine("1", "Imports System") scripter.AddCodeLine("1", "Class Raiser") scripter.AddCodeLine("1", " Public Event Constructed()") scripter.AddCodeLine("1", " Public Sub New()") scripter.AddCodeLine("1", " RaiseEvent Constructed()") scripter.AddCodeLine("1", " End Sub") scripter.AddCodeLine("1", "End Class") scripter.AddCodeLine("1", "Module Test") scripter.AddCodeLine("1", " Private WithEvents x As Raiser") scripter.AddCodeLine("1", " Public Sub Constructed() Handles x.Constructed") scripter.AddCodeLine("1", " Console.WriteLine(""Constructed"")") scripter.AddCodeLine("1", " End Sub") scripter.AddCodeLine("1", " Public Sub Main()") scripter.AddCodeLine("1", " x = New Raiser") scripter.AddCodeLine("1", " x = New Raiser") scripter.AddCodeLine("1", " End Sub") scripter.AddCodeLine("1", "End Module") scripter.Run(RunMode.Run) If scripter.HasErrors Then MessageBox.Show(scripter.Error_List(0).Message) End If End Sub End Class