对于我中的每个控件 [英] for each control in me.controls

查看:414
本文介绍了对于我中的每个控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我想对每个命令(例如
)禁用表单中的所有TextBox

Hi For All
I Want Disable All TextBox in my form using for each command such as

for each control ontrol in me.controls
    if control.gettype is gettype textbox then
         control.enable=false
    end if
next


但是我写了错误代码,请帮帮我
感谢


But I have written mistake code please help me
thanks

推荐答案

尝试:
For Each c As Control In Controls
    Dim t As TextBox = TryCast(c, TextBox)
    If t IsNot Nothing Then
        t.Enabled = False
    End If
Next


尝试
for each control ontrol in me.controls
    if ontrol.gettype is gettype textbox then
         ontrol.enable=false
    end if
next


这篇关于对于我中的每个控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆