如何一次启用表单中的所有文本框? [英] How to enable all the text boxes in the form at a time ?

查看:75
本文介绍了如何一次启用表单中的所有文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何一次对表单中的所有文本框启用false?

How to enable false to all the text boxes in the form at a time ?

推荐答案

尝试此操作...
Try this...
foreach(Control c in Controls)
{
   if(c is TextBox)
   {
      c.Enabled = true;
   }
}


在这种情况下,我要做的就是将控件放到面板上,当我需要禁用它们时,我以这种方式禁用了面板的所有子项.这样,您可以在不同面板上创建控件组,并且可以分别启用/禁用它们.这是我一直使用的解决方案.
What I do in such situations is that I put the controls to a panel and when I need to disable them I disable the panel this way all of its children are disabled. This way you can create groups of controls on different panels and you can enable/disable them individually. This is a solution I always use.


这篇关于如何一次启用表单中的所有文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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