標題: [發問] For ... To ... 的問題 [打印本頁] 作者: e123chen 時間: 2011-4-12 13:40 標題: For ... To ... 的問題
For ... To ... 的問題
每次寫 For i=0 To N 就好像很懂,套上 For j=0 To M 就很暈。
請問如何將這個:
Private arr1() As Class1命令按鈕
Private arr2() As Class1命令按鈕
Private arr3() As Class1命令按鈕
..........
Private Sub UserForm_Initialize()
ReDim arr1(Me.Frame1.Controls.Count - 1)
For i = 0 To Me.Frame1.Controls.Count - 1
Set arr1(i) = New Class1命令按鈕
Set arr1(i).Class1縣市區 = Me.Frame1.Controls(i)
Next
ReDim arr2(Me.Frame2.Controls.Count - 1)
For i = 0 To Me.Frame2.Controls.Count - 1
Set arr2(i) = New Class1命令按鈕
Set arr2(i).Class1縣市區 = Me.Frame2.Controls(i)
Next
ReDim arr3(Me.Frame3.Controls.Count - 1)
For i = 0 To Me.Frame3.Controls.Count - 1
Set arr3(i) = New Class1命令按鈕
Set arr3(i).Class1縣市區 = Me.Frame3.Controls(i)
Next
..........
End Sub
簡化成
For i=0 To N
For j=0 To M
.....
........
Next j
Next i作者: e123chen 時間: 2011-4-12 13:46