'先引用Microsoft Script Control 1.0
Private Sub Command1_Click()
Dim sc As New ScriptControl
Set sc = CreateObject("ScriptControl")
sc.Language = "vbscript"
Text2.Text = sc.Eval(Text1.Text)
End Sub
你得用循环判断 字符
for i =1 to len(text1)
dim StrZf as string
StrZf =right(left(text1,i),1)
if StrZf <> "+" or StrZf <> ">" ... then
StrNumber = StrNumber + StrZf
else
StrOperator = StrZf
if strOperator = "+" then
text2 =cstr(val(text2) + val(StrNumber ))
elseif strOperator = ">" then
...
end if
StrNumber =""
end if