16,472
社区成员
发帖
与我相关
我的任务
分享
Private Sub Form_Load()
Dim math As ShowjiSvcLib.MyMath
Set math = New ShowjiSvcLib.MyMath
MsgBox math.Sum(10, 19)
Set math = Nothing
End Sub
Dim math As ShowjiSvcLib.MyMath '定义一个ShowjiSvcLib.MyMath类型的变量,VB是可以直接支持ActiveX作为类型的,只要引用了该库
Set math = New ShowjiSvcLib.MyMath '创建一个该类型的ShowjiSvcLib.MyMath实例,其实这两句可以合并为:Dim math As New ShowjiSvcLib.MyMath
MsgBox math.Sum(10, 19) '调用该math对象的Sum接口方法,把结果用MsgBox显示出来
Set math = Nothing '销毁math对象