【发布时间】:2010-11-11 14:35:35
【问题描述】:
我通过从数据库创建列表来动态填充 winforms 组合框。
List<string> locationList = new List<string>();
foreach(Data.DataSet.vwGet_RepListRow row in Data.Manager.TAM.RepListViewTableAdapter.GetData())
locationList.Add(row.Location_City);
this.LocationComboBox.DataSource = locationList;
我遇到的问题是,现在总共有 3 个地点,但有 65 名员工,所以发生的事情是我在组合框中重复了城市。如何在上面进行编辑以检查新的 Location_City 是否已存在于 locationList 中?如果不存在,则添加它,但如果存在,则跳过它。
任何帮助都会很棒。
【问题讨论】: