日期:2011-08-01  浏览次数:20499 次

    Private mCnt As Integer '控件总数

    Private Function ControlCnt(ByVal Ctrl As Object) As Integer
        Dim i As Integer
        For i = 0 To CType(Ctrl, Control).Controls.Count - 1
            If CType(Ctrl, Control).Controls(i).Controls.Count = 0 Then
                mCnt = mCnt + 1
            Else
                Me.ControlCnt(CType(Ctrl, Control).Controls(i))
            End If
        Next
    End Function
    Me.ControlCnt(Me)
    Response.Write(CStr(mCnt))