VB6.0巧用ScriptControl实现多功能科学计算器

下载地址:
http://download.csdn.net/download/imaegoo/5646305

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Private Sub Command_Click()

On Error GoTo Command_Click_Err
0 Dim ScriptControl As Object, Psw$
2 Dim code As String
100 code = "Function encodePwd" & vbCrLf & "encodePwd = " & Text1.Text & vbCrLf & "End Function"
102 Set ScriptControl = CreateObject("MSScriptControl.ScriptControl")
104 ScriptControl.Language = "VBScript"
106 ScriptControl.Timeout = -1
108 ScriptControl.AddCode code
110 Psw = ScriptControl.Run("encodePwd")
112 Text2.Text = Psw
114 Text1.SetFocus
Exit Sub

Command_Click_Err:
MsgBox "::>_<:: 有以下错误" & vbCrLf & Err.Description & vbCrLf & _
"发生在 VBS语言计算器.MainForm.Command_Click " & _
"的第 " & Erl & " 行" & vbCrLf & vbCrLf & "检查一下你的语法是否正确 :)", _
vbExclamation + vbOKOnly, "出错啦!"
Resume Next
'foot
End Sub

VB6.0巧用ScriptControl实现多功能科学计算器

https://www.imaegoo.com/2018/vb-calculator/

作者

iMaeGoo

发布于

2018-03-01

更新于

2018-03-01

许可协议

CC BY 4.0

评论

微信二维码