Private Sub Form_Activate() Dim a As Control For Each a In Me.Controls Print a.Name Next End Sub
Private Sub Command1_Click() '对象数组ControlArray为所求 Dim i As Integer, ControlArray() As Control, j As Integer i = Me.Count j = 0 ReDim Preserve ControlArray(1 To i) As Control Dim a As Control For Each a In Me.Controls j = j + 1 Set ControlArray(j) = a Print ControlArray(j).Name Next Print j End Sub
Me.Controls.count Me.Controls(i).name
For Each ctl In Me.Controls ..... Next ------------------------------------------------------------------ 个人专栏:http://www.csdn.net/develop/author/netauthor/lihonggen0/ ------------------------------------------------------------------
for each ?? 楼上的都写了 我就next吧。
For Each ctl In Me.Controls ..... Next ------------------------------------------------------------------ 个人专栏:http://www.csdn.net/develop/author/netauthor/lihonggen0/ ------------------------------------------------------------------ 不愧是灌水高兴,有上面写的有什么区别..?也没有新的东西...也好意思贴出来..晕呀..这个网站的人真是...
Dim a As Control
For Each a In Me.Controls
Print a.Name
Next
End Sub
'对象数组ControlArray为所求
Dim i As Integer, ControlArray() As Control, j As Integer
i = Me.Count
j = 0
ReDim Preserve ControlArray(1 To i) As Control
Dim a As Control
For Each a In Me.Controls
j = j + 1
Set ControlArray(j) = a
Print ControlArray(j).Name
Next
Print j
End Sub
Me.Controls(i).name
.....
Next ------------------------------------------------------------------
个人专栏:http://www.csdn.net/develop/author/netauthor/lihonggen0/
------------------------------------------------------------------
楼上的都写了
我就next吧。
.....
Next ------------------------------------------------------------------
个人专栏:http://www.csdn.net/develop/author/netauthor/lihonggen0/
------------------------------------------------------------------
不愧是灌水高兴,有上面写的有什么区别..?也没有新的东西...也好意思贴出来..晕呀..这个网站的人真是...