簡體   English   中英

根據組合框 c# 的選擇,我的代碼沒有切換到所需的 function

[英]My code is not switching to the desired function depending upon the selection from combo box c#

即使我從下拉列表中選擇了 CHEMICAL,代碼也沒有調用 show_auto function,它總是調用 show_cement function。

private void gunaComboBox1_SelectedIndexChanged(object sender, EventArgs e) {
    ArrayList companyName = new ArrayList();
    ArrayList Price = new ArrayList();
    ArrayList category = new ArrayList();

    String selected = this.gunaComboBox1.GetItemText(this.gunaComboBox1.SelectedItem);

    if (selected.Equals("CHEMICAL")) {
        show_auto(companyName, Price, selected);
    } else {

        show_cement(companyName, Price, "CEMENT");
    }
}
String selected = gunaComboBox1.selecteditem.text;

然后與“化學”比較

暫無
暫無

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

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