Using a foreach loop to retrieve TextBox's within a GroupBox

前端 未结 4 1071
孤城傲影
孤城傲影 2020-12-17 06:06

I have ten group boxes in a WinForm. Each group box contains 10 text boxes, and I have defined each TextBox name. How can I get each text box usin

4条回答
  •  無奈伤痛
    2020-12-17 06:50

    try following code,

    Control.ControlCollection coll = this.Controls;
    foreach(Control c in coll) {
      if(c != null)
    }
    

提交回复
热议问题