7,785
社区成员




'工程添加组件 Microsoft Script Control 1.0
'--------
'Form1
'放1个ScriptControl、1个TextBox、1个CommandButton
Option Explicit
Private Sub Command1_Click()
With ScriptControl1
.Language = "VBScript"
.Reset
'添加已知变量'
.AddCode "a = 10"
.AddCode "b = 3"
'计算公式'
MsgBox .Eval(Text1)
End With
End Sub
Private Sub Form_Load()
Text1.Text = "a*b" '默认公式'
End Sub