Purpose
You want to call up a VB.NET function from JavaScript

Solution
In your  GuiXT script or InputScript, use a VB call that returns an object of the VB class that you want to use in JavaScript.
Pass this object to JavaScript and store it in a global variable. You can now access all public properties of this object in JavaScript and call up its public methods and functions.

Example
In VB.NET we implement a class "myfileinfo":

VB.NET

Public Class myfileinfo

    ' return an object of this class
    Function create() As Object
        Return New myfileinfo
    End Function

    ' return length (in bytes) of a file
    Public Function length(filename As String) As Integer

        ' file exists? else return -1
        If Not My.Computer.FileSystem.FileExists(filename) Then
            Return -1
        End If

        ' return file length
        Return My.Computer.FileSystem.GetFileInfo(filename).Length

    End Function

End Class

In our GuiXT script (or InputScript) we create an object of class "myfileinfo" and pass it to JavaScript. Then we call up a JavaScript test function that shows the length of a file, determined via the VB.NET function.

GuiXT Script

// Create a "myfileinfo" object in VB and pass it to JavaScript
if not V[vbFileinfo]
   CallVB vbFileinfo = utilities.myfileinfo.create
 
CallJS setFileinfo "&V[vbFileinfo]"
endif

// Test with filelength function
CallJS test "C:\temp\text.txt"


In Javascript we store the passed VB.NET object into a global variable. In all subsequent functions we can use its public VB.NET properties, methods and functions:

JavaScript 

// VB object of class "fileinfo"
var vbFileinfo;

function setFileinfo(obj)
{
    vbFileinfo = obj;
}

function test(filename)
{
    // determine file length
    var leng = vbFileinfo.length(filename);

    // display test message
    alert(leng);
};

 

Remark

Instead of creating a new object of class "myfileinfo" in VB.NET you can return the object that GuiXT has already allocated for the call:

Public Class myfileinfo

    ' return this object
    Function create() As Object
        Return me
    End Function

    ...
    

Components
InputAssistant + Controls