public partial class Form1 : Form??? {??????? public Form1()??????? {??????????? InitializeComponent();??????????? List list = new List();??????????? list.Add(new Source??????????? {??????????????? ID = "1",??????????????? Name = "kobe"??????????? });??????????? list.Add(new Source??????????? {??????????????? ID = "2",??????????????? Name = "JORDAN"??????????? });??????????? this.comboBox1.DisplayMember = "Name";??????????? this.comboBox1.ValueMember = "ID";??????????? this.comboBox1.DataSource = list;
??????????? this.comboBox2.DisplayMember = "Name";??????????? this.comboBox2.ValueMember = "ID";??????????? this.comboBox2.DataSource = list;??????? }??? }??? public class Source??? {??????? public string ID { get; set; }??????? public string Name { get; set; }??? }
(選擇后)為什么combox1變化后。。combox2跟著變化????高手請教!??!...
5 回答

幕布斯6054654
TA貢獻1876條經驗 獲得超7個贊
因為你共用了一個變量list,? this.comboBox1.DataSource = list;改成? this.comboBox1.DataSource = list.ToList();
- 5 回答
- 0 關注
- 341 瀏覽
添加回答
舉報
0/150
提交
取消