使用脚本控件实现,几行代码完成最简单的表达式计算器
Option Explicit
Dim MSSC As New MSScriptControl.ScriptControl
Private Sub Command1_Click()
On Error GoTo eh
Label1.Caption = MSSC.Eval(Text1.Text)
' Text1.Text = ""
Exit Sub
eh:
Label1.Caption = Err.Description
End Sub
Private Sub Form_Load()
MSSC.Language = "JScript"
End Sub
Views: 26