Creating a loop that will edit 60 TextBox names?

前端 未结 4 1172
傲寒
傲寒 2021-01-26 05:27

text box set1 = 1 to 30 = in the query name = br1id to br30id

textbox set 2 = 1 to 30 = in the result output

i dont understand how to create a loop based on 30

4条回答
  •  滥情空心
    2021-01-26 06:05

    You will want to use a control enumerator.

    Assuming that this is WinForms:

    foreach(Control c in this.Controls) {
        if(c is TextBox)
            Console.WriteLine(c.Text);   
    }
    

    And actually, I think that will work for ASP.Net, too. (Even though Control is in a diferent namespace.)

    HOWEVER!: This is what a datagrid was made for.

提交回复
热议问题