请问求解多维数组维数的函数是什么?

死亡幻影 2003-11-28 05:12:48
谢了
...全文
78 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wumy_ld 2003-11-28
  • 打赏
  • 举报
回复
Public Function Dimensions(VariantArray) As Integer
'Determine the number of dimensions for a Variant array

'handle all errors locally
On Error GoTo Dimensions_Err

'define local variables
Dim Ctr As Integer
Dim TestVal As Long

Do
'loop and increment counter
Ctr = Ctr + 1
'test then upper bound of the dimension
TestVal = UBound(VariantArray, Ctr)
Loop

Dimensions_Cont:
'all done
Exit Function

Dimensions_Err:
'When an error occurs we have exceeded the number of
'dimensions in our variant array by one. The true number
'of dimensions is the counter less one.
Dimensions = Ctr - 1

'Reset then Err object and exit the function
Resume Dimensions_Cont
End Function
ball 2003-11-28
  • 打赏
  • 举报
回复
UBound有什么作用?
SoHo_Andy 2003-11-28
  • 打赏
  • 举报
回复
Function GetArryCount(Temp() As Integer) As Integer
Dim i As Integer
Dim T As Integer
Const ItemCount = 1000
On Error GoTo Err1
For i = 0 To ItemCount
T = UBound(Temp, i + 1)
Next i
Err1:
GetArryCount = i
End Function

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧