• HOME
  • PRODUCTS
  • DEMOS
  • BUY
  • BLOG
  • FORUM
  • DOCUMENTATION
  • ABOUT
  • FREE EVALUATION
Search Results for

    Show / Hide Table of Contents

    GlobalItems Property

    GlobalItems

    Gets or sets a script items collection attached to this runner.

    Declaration
    [Browsable(false)]
    public IList<IScriptGlobalItem> GlobalItems { get; }
    Property Value
    Type Description
    IList<IScriptGlobalItem>
    Implements
    IScriptRun.GlobalItems
    Remarks

    Use GlobalItems to add application-defined objects that can be accessed from the script code.

    These objects are represented in the script code as public fields of the ScriptGlobalClass static class. Scripts need to be compiled as dynamic link libraries for these fields to be initialized upon script execution.

    Examples

    Here is how to use a GlobalItems in the C# code:

    using System.Linq;
    using System.Windows.Forms;
    
    using Alternet.Scripter;
    
    public partial class Form1 : Form
    {
        private ScriptRun scriptRun;
        private void Form1_Load(object sender, EventArgs e)
        {
            scriptRun = new ScriptRun();
            scriptRun.ScriptLanguage = ScriptLanguage.CSharp;
            AddScriptItem();
        }
    
        private void AddScriptItem()
        {
            ScriptGlobalItem item = new ScriptGlobalItem("RunButton", typeof(System.Windows.Forms.Button), btNETFromScript);
            scriptRun.GlobalItems.Clear();
            scriptRun.GlobalItems.Add(item);
        }
    }
    

    Here is how to use a GlobalItems in the Visual Basic code:

    Imports System.Linq
    Imports System.Windows.Forms
    Imports Alternet.Scripter
    
    Partial Public Class Form1
        Inherits Form
    
        Private scriptRun As ScriptRun
    
        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
            scriptRun = New ScriptRun()
            scriptRun.ScriptLanguage = ScriptLanguage.CSharp
            AddScriptItem()
        End Sub
    
        Private Sub AddScriptItem()
            Dim item As ScriptGlobalItem = New ScriptGlobalItem("RunButton", GetType(System.Windows.Forms.Button), btNETFromScript)
            scriptRun.GlobalItems.Clear()
            scriptRun.GlobalItems.Add(item)
        End Sub
    End Class
    
    In This Article
    Back to top Copyright AlterNET Software Download PDF