看板 C_Sharp 關於我們 聯絡資訊
想用基礎寫法 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { comboBox1.Text = comboBox1.Items[0].ToString(); label2.Text = "21"; label4.Text = "100"; label6.Text = "111"; comboBox1.Text = comboBox1.Items[1].ToString(); label2.Text = "27"; label4.Text = "40"; label6.Text = "222"; //comboBox1.Items[2].ToString(); //label2.Text = "12"; //label4.Text = "300"; //label6.Text = "50"; } 以上我想選擇Items裡面不同選項顯示不同數據 可是用comboBox1.Text = comboBox1.Items[0].ToString();寫法 會造成無線迴圈/遞迴 用comboBox1.Items[0].ToString();只會顯示最後一組數據 我想加上if(comboBox1.Text = comboBox1.Items[0].ToString()) 就顯示錯誤 無法將型別 'string' 隱含轉換為 'bool' C#新手上路~多多包涵 -- ◢██◣█▇▆▅▄ ◣ ◢ ◢█◣◢█◣ ┐│ ╔║║ ◣ ◢▉ ◢█◣ ◢█◣█ █◢█◣███████▆◣ │┤ ║║║ ◥██◤ ▊ ▋ █ ▋▄◤◥█◤▌▄◤◥████◤ ▌ ▋ 人│ ║╠╣ ◣◢▋ ◥█▋▌◥▄▃ █ ◥▅▂ ◥██◤ ▌ ▊ │ ║║║ ▅▅◥◤ ╰─ ╚║║ —— The Red Captain Gee~Gee~Gee~Gee Tae~Tae~Tae~Tae~Tae~yeon~by jimmy508 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.118.114.74
yeo1987:== -.- 08/20 17:05
liaommx:if(a=b) 當然這個if,一直都會執行啊 08/20 17:08
liaommx:判斷式要用 == 兩個等於 08/20 17:09
zuoai4321:感謝大神~ 08/20 17:16