[問題] combobox輸出
想用基礎寫法
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
→
08/20 17:05, , 1F
08/20 17:05, 1F
推
08/20 17:08, , 2F
08/20 17:08, 2F
→
08/20 17:09, , 3F
08/20 17:09, 3F
→
08/20 17:16, , 4F
08/20 17:16, 4F
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章