如何在textbox输入四则运算式,获得计算结果?
在TextBox控件中, 输入"2*(2+1)+10/5-2"
其运行结果是 debug.print 6
请问
[解决办法]
debug.print eval(textboxe2)
[解决办法]
Function CalcStr(StrNum As String) As Double
Set MSSC = CreateObject("MSScriptControl.ScriptControl")
MSSC.Language = "VBScript"
CalcStr = MSSC.Eval(StrNum)
Set MSSC = Nothing
End Function