« FileSystemObjectフォルダ再帰検索 | Main

コントロール配列かどうかを判別

Private Sub Form_Load()
Dim ctl As Control
For Each ctl In Me.Controls
    If TypeName(Controls(ctl.Name)) = "Object" Then
        Debug.Print ctl.Name & "(" & CStr(ctl.Index) & ")"
    Else
        Debug.Print ctl.Name
    End If
Next ctl
End Sub

'別解
Function iscontrolarray(ctl As Control) As Boolean
On Error GoTo iscontrolarray_err
    Dim i As Long
    i = ctl.Index
    iscontrolarray = True
Exit Function
iscontrolarray_err:
If Err.Number = 343 Then
    iscontrolarray = False
End If
End Function

|

« FileSystemObjectフォルダ再帰検索 | Main

Comments

Post a comment



(Not displayed with comment.)




TrackBack

TrackBack URL for this entry:
http://app.cocolog-nifty.com/t/trackback/4099/746263

Listed below are links to weblogs that reference コントロール配列かどうかを判別:

« FileSystemObjectフォルダ再帰検索 | Main