M
Mad Scientist Jr
Is there a native .NET equivalent of the Microsoft Script Control,
particularly the Eval method? See here:
http://www.devx.com/vb2themax/Tip/18773
It works great - it even compares string expressions. I just would
prefer a native .NET version over COM if at all possible.
Sample code:
Dim scriptControl1 As New MSScriptControl.ScriptControl
Dim sExp As String
scriptControl1.Language = "VBScript"
Textbox1.Text = ""
sExp = "12 + 3 * 10"
Textbox1.Text += sExp & " = " & scriptControl1.Eval(sExp) & vbCrLf
sExp = "(`abba` < `bagel`)"
sExp = Replace(sExp, "`", Chr(34))
Textbox1.Text += sExp & " = " & scriptControl1.Eval(sExp) & vbCrLf
sExp = "(`red` < `bagel`)"
sExp = Replace(sExp, "`", Chr(34))
Textbox1.Text += sExp & " = " & scriptControl1.Eval(sExp) & vbCrLf
sExp = "((1*5)*5)"
sExp = Replace(sExp, "`", Chr(34))
Textbox1.Text += sExp & " = " & scriptControl1.Eval(sExp) & vbCrLf
sExp = "( (`abba` < `bagel`) and true) or ( ((1*5)*5) = 25 ) "
sExp = Replace(sExp, "`", Chr(34))
Textbox1.Text += sExp & " = " & scriptControl1.Eval(sExp) & vbCrLf
particularly the Eval method? See here:
http://www.devx.com/vb2themax/Tip/18773
It works great - it even compares string expressions. I just would
prefer a native .NET version over COM if at all possible.
Sample code:
Dim scriptControl1 As New MSScriptControl.ScriptControl
Dim sExp As String
scriptControl1.Language = "VBScript"
Textbox1.Text = ""
sExp = "12 + 3 * 10"
Textbox1.Text += sExp & " = " & scriptControl1.Eval(sExp) & vbCrLf
sExp = "(`abba` < `bagel`)"
sExp = Replace(sExp, "`", Chr(34))
Textbox1.Text += sExp & " = " & scriptControl1.Eval(sExp) & vbCrLf
sExp = "(`red` < `bagel`)"
sExp = Replace(sExp, "`", Chr(34))
Textbox1.Text += sExp & " = " & scriptControl1.Eval(sExp) & vbCrLf
sExp = "((1*5)*5)"
sExp = Replace(sExp, "`", Chr(34))
Textbox1.Text += sExp & " = " & scriptControl1.Eval(sExp) & vbCrLf
sExp = "( (`abba` < `bagel`) and true) or ( ((1*5)*5) = 25 ) "
sExp = Replace(sExp, "`", Chr(34))
Textbox1.Text += sExp & " = " & scriptControl1.Eval(sExp) & vbCrLf