Hello.
Is there any VB function which allows to compute an expression?
Example:
In a textbox input:"2+2"
On button click
msgbox compute (me.text1)
Thank you
Printable View
Hello.
Is there any VB function which allows to compute an expression?
Example:
In a textbox input:"2+2"
On button click
msgbox compute (me.text1)
Thank you
Add a reference to the component: Microsoft Script Control 1.0
Code:Private Sub Command1_Click()
Dim script As ScriptControl
Set script = New ScriptControl
script.Language = "VBScript"
Debug.Print script.Eval("2+2")
End Sub
You could add the Microsoft Script Control to your Form and the use code simular to this:Edit: I'm just too slow today :)vb Code:
MsgBox ScriptControl1.Eval(Text1.Text)
Add a Microsoft Script Control to your components. Add new component to your form. use likeThere are some examples here. search and see.Code:ScriptControl1.Eval("2+2")
:wave:
I m damn slow, as usual :D
Awesome...
Thank you