if (radioGroup1.SelectedIndex == 2)
{
bool _Flag = true;
sm.SetLciVisible(lciDelete, _Flag);
sm.SetLciVisible(lciUnitName, _Flag);
IsReadOnly(_Flag);
try
{
UnitDAL dalUnit = new UnitDAL();
dtUnit = dalUnit.GetData();
txtUnitName.Properties.Items.Clear();
for (int i = 0; i < dtUnit.Rows.Count; i++)
{
txtUnitName.Properties.Items.Add(dtUnit.Rows[i][1].ToString());
}
}
catch (Exception ex)
{
XtraMessageBox.Show(ex.Message,Properties.Resources.ErrorTitle);
}
}
实现效果:点击下拉控件,显示出的列表是数据库中对应表的每条数据的名字(比如Name 列下的所以数据)。