Dim d As String = "1250/300" '公约数
Dim x As Integer = math.min(val(d.SubString(0,d.Indexof("/"))),val(d.SubString(d.Indexof("/")+1)))
Dim y As Integer = math.mAx(val(d.SubString(0,d.Indexof("/"))),val(d.SubString(d.Indexof("/")+1)))
If val(d.SubString(0,d.Indexof("/"))) = 0 Then
y = 0
Return y
Else
Dim temp As Integer
Do While x <> 0
temp = y Mod x
y = x
x = temp
Loop
End If
y = math.abs(y)
Return(y)
上面代码在命令窗口执行时正确,在自定义函数中运行时出错,用帮助实例运行也出错。如自定义函数名称:“函数1”
Dim i As Integer = args(0)
Dim Sum As Integer
Do While i < 100
Sum = Sum + i
i= i + 2
Loop
Return Sum
命令窗口执行:output.show(Functions.Execute("函数1"),1)
错误提示:
编译错误:“Public Shared Sub Show(O10llO0 As String)”的参数太多。
错误代码:output.show(Functions.Execute("函数1"),1)
已解决,“)”位置错误
[此贴子已经被作者于2012-10-6 9:57:38编辑过]