3 nov 2007

Eval en .NET - Microsoft.JScript.Eval.JScriptEvaluate

   Dim overhead As String = "10"
        Dim a As Integer
        Dim b As Integer
        Dim c As Integer
        c = 20
        a = 10
        b = 15
        Dim sExpression As String = "a+b"
        sExpression = Replace(sExpression, "a", a)
        sExpression = Replace(sExpression, "b", b)
        MsgBox(sExpression)
        Dim oResult As Object

        Try
            Dim myEngine As Microsoft.JScript.Vsa.VsaEngine = Microsoft.JScript.Vsa.VsaEngine.CreateEngine()
            oResult = Microsoft.JScript.Eval.JScriptEvaluate (sExpression, myEngine)

            MsgBox(oResult)
        Catch ex As Exception
            MsgBox(ex.Message & ex.Source)
        End Try

No hay comentarios:

FeedCount

analytics

 
sfrede