首页 > 编程 > .NET > 正文

获得页面上的控件总数 VB.Net

2024-07-10 13:07:11
字体:
来源:转载
供稿:网友

    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))

 

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表