簡體   English   中英

使用 For 循環更改組合框值

[英]Using For loop to change combo box value

我有 20 個組合框名稱的列表:combobox1z 到 combobox20z。 我想通過列表和 for 循環設置那些 combobox 的文本,不知道是否有可能像:

for (int i = 1; i < 21; i++)
{
    comboxbox[i]z.Text = stringlist[i];
}

**

嘗試這個

**

for (int i = 1; i < 21; i++)

{

ComboBox comboBox = new ComboBox();

comboBox = this.Controls.Find("comboxbox" + i.ToString()+"Z", false)[0];

   for (int y = 1; y < 21; y++)

   {

       comboBox1.Items.Add (stringlist[y]);

   }

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM