开发者

Relationship between Comboboxes in C#

开发者 https://www.devze.com 2023-02-25 19:41 出处:网络
I have 2 comboboxes. Each of them are bounded to same Table. When I change value in one of them the other combobex appropriate开发者_如何学Pythonly changed. How can I solve this problem?Bind first Co

I have 2 comboboxes.

Each of them are bounded to same Table. When I change value in one of them the other combobex appropriate开发者_如何学Pythonly changed. How can I solve this problem?


Bind first ComboBox with data table then make a copy of data table in memory and bind it to the second ComboBox.

DataTable dataTable = db.FetchData();
ComboBox1.DataSource = dataTable;

// copying both structure and data
DataTable secondDataTable = dataTable.Copy();
ComboBox2.DataSource = secondDataTable;
0

精彩评论

暂无评论...
验证码 换一张
取 消