.net ComboBox与DX中的ComboBoxEdit绑定数据
ComboBox
//加载公司 this.companyList = new CompanyDAO().GetAllCompany("all"); this.cbSrcCompany.DataSource = companyList; this.cbSrcCompany.DisplayMember = "CompanyFullName";
ComboBoxEdit
this.userList = this.GetUserList(); foreach (UserInfo user in userList) { this.cbUsername.Properties.Items.Add(user.UserName); } if (userList.Count > 0) { this.cbUsername.SelectedIndex = 0;//默认第一条数据 UserInfo userInof = userList[0]; this.chk_savePassword.Checked = userInof.IsSavePwd; this.cbUsername.Text = userInof.IsSavePwd ? userInof.UserPwd : ""; //如果保存密码,则取出密码 this.Refresh(); Application.DoEvents(); }