ubound(a)=4
把倒数第4、5行去掉。
最终代码为:
Private Sub command1_click()
dim b%(1 to 4),i%,t#
for i=1 to 4
b(i)=i
next i
t=tof(b( ))
print "t=";t,
end sub
Function tof( a() as integer)
dim t#,i%
t=1
for i=2 to ubound(a)
t=t*a(i)
next i
tof=t
end function