Testing VB.NET language features. Arrays.

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", "Module Test")
        scripter.AddCodeLine("1", "Sub Main()")
        scripter.AddCodeLine("1", "  Dim arr(5) As Integer = {0, 1, 2, 3, 4}")
        scripter.AddCodeLine("1", "  Dim I As Integer")
        scripter.AddCodeLine("1", "  For I = 0 To arr.Length - 1")
        scripter.AddCodeLine("1", "    Console.WriteLine(""arr("" & I & "") = "" & arr(I))")
        scripter.AddCodeLine("1", "  Next I")
        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


Copyright © 2005-2022 Alexander Baranovsky. All rights reserved.