winforms - 如何在 Devexpress 的 ComboBoxEdit 中选择项目
问题描述
在下面的代码中,我需要选择 Item in ComboBoxEdit
with idFunc
。
我怎样才能做到这一点?
ComboBoxItemCollection coll = cbFunction.Properties.Items;
coll.BeginUpdate();
coll.Add(" ... select function ... ");
foreach (var item in lstFuncCB)
{
cbFunction.Properties.Items.Add(new ImageComboBoxItem(item.FuncName, item.idFunc));
}
coll.EndUpdate();
解决方案
您只需将 ComboBoxEdit 控件的 EditValue 属性设置为您希望选择的 item.idFunc 值。
cbFunction.EditValue = lstFuncCb[3].idFunc;
推荐阅读
- android - 如何使用改造和获取 id 保存 android SharedPreferences
- python - 使用openpyxl在excel下方附加数据帧时,我的excel表中的切片器被破坏
- modelica - 使用“在模型中保存起始值”选项帮助 Dymola 中的收敛
- javascript - 如何在nodejs中执行顺序基本命令?
- c - C 中的一个类型可以有多个对象表示吗?
- python - Pytorch 中的切片给出了错误的答案
- node.js - async/await 不适用于 mongoose 实例方法
- c# - 在新的 .NetCore API 中使用现有的 AspNet.Identity (MVC)
- sql - SQL查询如何在Oracle/Hive中获取一周/年的最后一个工作日?
- kubernetes - Google 调试:如何调试可执行 jar 中的库 - 错误:在可执行文件中找不到文件