Avatar of lelandgaunt

asked on 

How do I eval with Scriptcontrol an own function in VB.NET?


I try to evaluate my own function with Scriptcontrol (vbscript language), but always got this error:
Type mismatch: 'TestMethod'
(code below)

Anyone could help?

Sorry for my weak english.


Imports MSScriptControl
Module Module1
    Public Sub Main()
        Dim scTemp As New ScriptControl()
        Dim blnResult As Boolean
            scTemp.Language = "VBScript"
            blnResult = CType(scTemp.Eval("TestMethod(True)"), Boolean)
        Catch ex As Exception
            MsgBox(ex.Message & vbCrLf & ex.StackTrace)
        End Try
    End Sub
    Public Function TestMethod(ByVal blnParam As Boolean) As Boolean
        Return blnParam
    End Function
End Module

Open in new window

Visual Basic.NET

Avatar of undefined
Last Comment

8/22/2022 - Mon