源码分享

vb6最简单的表达式计算器.zip

使用脚本控件实现,几行代码完成最简单的表达式计算器

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: 25

Hi, I’m 邓伟

本来无一物,何处惹尘埃

发表回复