用 For Each .... 迴圈可以在 Form 中逐一判斷物件類別,如:
Dim oMO As Object
For Each oMO In Form1.Controls
If TypeOf oMO Is CommandButton Then
oMO.Enabled = ...
....
....
End If
Next
但是,我要在 MDIForm 中逐一判斷尋找 Form 要如何做呢?
以下是我想到的,可是不行
Dim oMO As Object
For Each oMO In MDIForm1.Controls
If TypeOf oMO Is Form Then
oMO.Enabled = ...
....
....
End If
Next