If Text1 = "" Then Exit Sub On Error GoTo errHandler Set s = CreateObject("ScriptControl") s.Language = "VBScript" Text1 = s.Eval(Text1) Set s = Nothing flag = True Exit Sub errHandler: Text1 = "E"
Private Sub Command1_Click() Dim sc As Object Set sc = CreateObject("ScriptControl") sc.Language = "VBScript"Text2.Text = sc.Eval(Text1.Text) End Sub Private Sub Form_Load() '\'系统初始化 Text1.Text = "3+5*4" End Sub
最简单就是采用 ScriptControlDim s
If Text1 = "" Then Exit Sub
On Error GoTo errHandler Set s = CreateObject("ScriptControl")
s.Language = "VBScript"
Text1 = s.Eval(Text1)
Set s = Nothing
flag = True
Exit Sub
errHandler: Text1 = "E"
Dim sc As Object
Set sc = CreateObject("ScriptControl")
sc.Language = "VBScript"Text2.Text = sc.Eval(Text1.Text)
End Sub
Private Sub Form_Load() '\'系统初始化
Text1.Text = "3+5*4"
End Sub