PaxScripter ASP.NET application written in VB.NET.


Imports PaxScript.Net

Public Class WebForm1
    Inherits System.Web.UI.Page
    Friend scripter As New PaxScript.Net.PaxScripter

#Region " Web 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.RegisterType(GetType(Page))
        scripter.RegisterType(GetType(Button))
        scripter.RegisterInstance("button1", Button1)
        scripter.RegisterInstance("Page", Page)

        scripter.AddModule("1", "VB")
        scripter.AddCodeLine("1", "Imports System.Web.UI.Page")
        scripter.AddCodeLine("1", "Dim btn As New System.Web.UI.WebControls.Button")
        scripter.AddCodeLine("1", "btn.Text = ""Script-defined Button""")
        scripter.AddCodeLine("1", "Button1.ID = ""Test""")
        scripter.AddCodeLine("1", "Page.FindControl(""Form1"").Controls.Add(btn)")

        scripter.Run(RunMode.Run)
        If scripter.HasErrors Then
            For i As Integer = 0 To scripter.Error_List.Count - 1
                Dim s As String = scripter.Error_List(i).Message & " - " & scripter.Error_List(i).LineNumber()
                Response.Write(s)
            Next
        End If
    End Sub
End Class


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