windows script control 1.0

  • Thread starter Thread starter VladimirT
  • Start date Start date
V

VladimirT

in vba is used windows script control 1.0 for molded got from txtFunction

as possible do this in vb.net?
thank you

I have written code but he does not work

Function FunctionEval(ByVal X As Double) As Double

ScriptControl.ExecuteStatement("X=" & X)
FunctionEval = ScriptControl.Eval(txtFunction.Text)

End Function
 
VladimirT said:
in vba is used windows script control 1.0 for molded got from txtFunction

as possible do this in vb.net?
thank you

I have written code but he does not work

Function FunctionEval(ByVal X As Double) As Double

ScriptControl.ExecuteStatement("X=" & X)
FunctionEval = ScriptControl.Eval(txtFunction.Text)

End Function

What does not work? Are you sure added the reference to the script control?
 
Function FunctionEval(ByVal X As Double) As Double

Try

ScriptControl.ExecuteStatement("X=" & X)

Console.WriteLine(ScriptControl.Eval("Cos(X * 10)"))

Console.WriteLine(Cos(X * 10))

Catch exc As Exception

Throw New Exception("Can't evaluate function at X=" & X)

End Try

yes certainly I have changed code

considers he ÐÒÁÉÌØÎÏ but stops on "END TRY" but gives error

An unhandled exception of type 'System.Exception' occurred in
WindowsApplication1.exe

Additional information: Can't evaluate function at X=1,00167224080268
 
yes certainly

he stops on "End try" and writes mistake

An unhandled exception of type 'System.Exception' occurred in
WindowsApplication1.exe

Additional information: Can't evaluate function at X=-0,996655518394649

Function FunctionEval(ByVal X As Double) As Double

Try

ScriptControl.ExecuteStatement("X=" & X)

Console.WriteLine(ScriptControl.Eval("Cos(X * 10)"))

Console.WriteLine(Cos(X * 10))



Catch exc As Exception

Throw New Exception("Can't evaluate function at X=" & X)

End Try

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top