【问题标题】:Loop for all the bunifu Controls and one for the bunifu Textbox循环所有 bunifu 控件和一个用于 bunifu 文本框
【发布时间】:2021-07-17 17:20:19
【问题描述】:

我通常使用此代码来清空表单的所有文本框,它 使用 bunifu 控件时不起作用

 ```


public void Clear(Control c)
            {
                foreach(Control ct in c.Controls)
                {
                    if(ct.GetType() == typeof(TextBox) || ct.GetType() == typeof(ComboBox))
                    {
                        ct.Text = "";
                    }
                    if(ct.Controls.Count != 0)
                    {
                        Clear(ct);
                    }
                }
            }

【问题讨论】:

    标签: c# controls bunifu


    【解决方案1】:

    我用过这段代码,但已经不行了。

     public void Clear(Control c)
                {
                    foreach (Control ct in c.Controls.OfType<BunifuTextBox>())
                    {
                        ct.Text = "";
        
                        if(ct.Controls.Count != 0)
                        {
                            Clear(ct);
                        }
                    }
                }
    

    【讨论】:

      猜你喜欢
      • 2023-01-04
      • 1970-01-01
      • 1970-01-01
      • 2018-09-10
      • 1970-01-01
      • 1970-01-01
      • 2018-08-31
      • 2018-09-03
      • 2020-10-17
      相关资源
      最近更新 更多