数据绑定:
string strSql = "SELECT [UserName],[Mail] FROM [OA].[dbo].[DZ_Users]"; DataTable dt = new DataTable(); dt = DbHelperSQL.Query(strSql.ToString()).Tables[0]; chklboxL.DataSource = dt; chklboxL.DisplayMember = "UserName"; chklboxL.ValueMember = "Mail"; this.checkedComboBoxEdit1.Properties.DataSource = dt; this.checkedComboBoxEdit1.Properties.DisplayMember = "UserName"; this.checkedComboBoxEdit1.Properties.ValueMember = "Mail"; checkedComboBoxEdit1.EditValue = "test1@zettlercn.com,test2@zettlercn.com"; //默认值获取:
string mail = string.Empty; DataRowView value = chklboxL.SelectedValue as DataRowView;