In this example, TextBox1.Text would contain your expression:
3+2*5
The result is placed into TextBox2.text.
Imports Microsoft.JScript
Try
Dim objResult As Object = Microsoft.JScript.Eval.JScriptEvaluate( _
TextBox1.Text, Microsoft.JScript.Vsa.VsaEngine.CreateEngine())
Dim t As Type = objResult.GetType()
'
' Normally, you would probably know in advance which Type would be
' returned by your evaluated code. For this example,
' we explicitly check for several base types.
'
Select Case t.ToString
Case "System.String"
TextBox2.Text = DirectCast(objResult, String)
Case "System.Int32"
TextBox2.Text = CStr(DirectCast(objResult, Integer))
Case "System.Int64"
TextBox2.Text = CStr(DirectCast(objResult, Long))
Case "System.Single"
TextBox2.Text = CStr(DirectCast(objResult, Single))
Case "System.Double"
TextBox2.Text = CStr(DirectCast(objResult, Double))
Case "System.Boolean"
TextBox2.Text = CStr(DirectCast(objResult, Boolean))
Case "System.Decimal"
TextBox2.Text = CStr(DirectCast(objResult, Decimal))
Case Else
TextBox2.Text = objResult.ToString
End Select
Catch ex As System.Exception
MsgBox(ex.ToString)
End Try