我如何避免在vb.net中的组合框中重复

时间:2012-09-17 11:51:58

标签: vb.net

如何在组合框中避免重复?

我有3个组合框,我希望用户可以添加或从现有值中选择,但当我选择其中一个现有项目时,它会复制该项目

With something
   .DataSource = empBindingsource 
   .DisplayMember = "Employer_Name" 
   .ValueMember = "Employer_ID" 
   .DataBindings.Add("selectedValue", job_VacanciesBindingsource, "Employer_ID", False, DataSourceUpdateMode.OnValidation) 
End With 

With cboDesc 
   .DataSource = descDataset.Tables("Job_Vacancies").Copy 
   .DisplayMember = "Job_Description" ' 
   .ValueMember = "Job_ID" 
   .DataBindings.Add("text", job_VacanciesBindingsource, "Job_Description", False, DataSourceUpdateMode.OnValidation) 
End With

1 个答案:

答案 0 :(得分:0)

您的问题不是很明确,但您可以尝试:

.DataSource = descDataset.Tables("Job_Vacancies").Copy.Distinct()