我的表單上有大約九個組合框,每個組合框都根據它之前的組合框進行過濾,所以當我更改第一個組合框的值時,我需要清除其余的,有沒有辦法遍歷所有組合框并清除每一個?我試過這個:private void Clear()
{ foreach (ComboBox cmb in Controls.OfType<ComboBox>())
cmb.Items.Clear();
}
1 回答

HUH函數
TA貢獻1836條經驗 獲得超4個贊
cmb.Items.Clear(); //this removes the items
cmb.ResetText(); //this clear text
- 1 回答
- 0 關注
- 93 瀏覽
添加回答
舉報
0/150
提交
取消