我有三个不同的组合框,我通过数据源分配相同的值,但每个选择更改都会影响其他实例。如何避免这种情况?
private void getVendorList()
{
DataTable data = this.vendorService.GetAllVendors();
this.LoadDataGridView(data);
//set vendor combobox datasource
comboAddProdVendorId.DataSource = data;
comboAddProdVendorId.ValueMember = "Id";
comboAddProdVendorId.DisplayMember = "Name";
comboSearchProdVendorId.DataSource = data;
comboSearchProdVendorId.ValueMember = "Id";
comboSearchProdVendorId.DisplayMember = "Name";
comboAddTransacVendorId.DataSource = data;
comboAddTransacVendorId.ValueMember = "Id";
comboAddTransacVendorId.DisplayMember = "Name";
}
答案 0 :(得分:1)
在分配给数据源之前,您需要DIRECTORY
DataTable
试试这个:
Copy