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", "Enum Color") scripter.AddCodeLine("1", " Red") scripter.AddCodeLine("1", " Green = 10") scripter.AddCodeLine("1", " Blue") scripter.AddCodeLine("1", "End Enum") scripter.AddCodeLine("1", "Module Test") scripter.AddCodeLine("1", "Sub Main()") scripter.AddCodeLine("1", " Console.WriteLine(StringFromColor(Color.Red))") scripter.AddCodeLine("1", " Console.WriteLine(StringFromColor(Color.Green))") scripter.AddCodeLine("1", " Console.WriteLine(StringFromColor(Color.Blue))") scripter.AddCodeLine("1", "End Sub") scripter.AddCodeLine("1", "Function StringFromColor(ByVal c As Color) As String") scripter.AddCodeLine("1", " Select Case c") scripter.AddCodeLine("1", " Case Color.Red") scripter.AddCodeLine("1", " Return String.Format(""Red = "" & CInt(c))") scripter.AddCodeLine("1", " Case Color.Green") scripter.AddCodeLine("1", " Return String.Format(""Green = "" & CInt(c))") scripter.AddCodeLine("1", " Case Color.Blue") scripter.AddCodeLine("1", " Return String.Format(""Blue = "" & CInt(c))") scripter.AddCodeLine("1", " Case Else") scripter.AddCodeLine("1", " Return ""Invalid color""") scripter.AddCodeLine("1", " End Select") scripter.AddCodeLine("1", "End Function") 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