List<Customer> _customers = getCustomers().ToList();
BindingSource bsCustomers = new BindingSource();
bsCustomers.DataSource = _customers;
comboBox.DataSource = bsCustomers.DataSource;
comboBox.DisplayMember = "name";
comboBox.ValueMember = "id";
现在,如何将组合框项目设置为列表中第一个项目以外的项目?
尝试过
comboBox.SelectedItem = 相同的客户;
...还有很多其他东西,但到目前为止还没有运气...
你应该做
comboBox.SelectedValue = "valueToSelect";
or
comboBox.SelectedIndex = n;
or
comboBox.Items[n].Selected = true;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)