【发布时间】:2020-06-06 08:27:53
【问题描述】:
好的,所以我在使用 ReDim 数组时遇到了问题;有人告诉我这是这样做的方法。我只是不确定将它放在哪里,或者每次通过函数时都必须添加到第一个整数 ((n, n)) 中。仅供参考,“Dim PropArray(0, 5) As String”位于“选项比较数据库”所在代码的最顶部。
Dim PropArray(0, 5) As String
Public Function ShowBeam()
For Each ctl In [Forms]![frmShelfBuilder]
If Left(ctl.Name, 3) = "Box" Then
If Int(Right(ctl.Name, (Len(ctl.Name)) - 3)) = Me.txtBeamCount Then
If Box1.Visible = False Then
Set rct = ctl
PropArray(0) = rct.Name
PropArray(1) = rct.Visible
PropArray(2) = rct.Height 'Int out
PropArray(3) = rct.Left 'Int out
PropArray(4) = rct.Top 'Int out
PropArray(5) = rct.Width 'Int out
Else
Set rct = ctl
'ReDim Preserve PropArray(n + 1, 5) where "n" is the current number in the row (I think this is were you would add the "ReDim Preserve"?)
PropArray(0) = rct.Name
PropArray(1) = rct.Visible
PropArray(2) = rct.Height 'Int out
PropArray(3) = rct.Left 'Int out
PropArray(4) = rct.Top 'Int out
PropArray(5) = rct.Width 'Int out
End If
End If
End If
Next
我认为我在正确的轨道上。我只是不知道在哪里 ReDim 保留数组以将 1 添加到第一个整数。欢迎任何建议。 Muchacho apreciado!
【问题讨论】:
标签: arrays vba ms-access multidimensional-array