how loop through multiple checkbox in C#

前端 未结 6 1056
后悔当初
后悔当初 2021-01-14 00:06

I have 100 checkbox in a winfrom. Their name is sequential like checkbox1,checkbox2 etc. I have a submit button in my winform. After clicking the submitting button, it check

6条回答
  •  爱一瞬间的悲伤
    2021-01-14 00:38

        foreach (Control childc in Page.Controls)
        {
    
                if (childc is CheckBox)
                {
                    CheckBox chk = (CheckBox)childc;
                    //do your operation
    
                }
    
        }
    

提交回复
热议问题