.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();
}
本文详细介绍了如何在.NET环境中利用DevExpress控件,将ComboBox与ComboBoxEdit进行数据绑定,包括加载公司数据到ComboBox,以及通过循环用户列表将其用户名添加到ComboBoxEdit中,并设置默认选项和密码保存状态。
3049

被折叠的 条评论
为什么被折叠?



