【发布时间】:2016-08-10 11:15:43
【问题描述】:
我想知道如何在 CheckedComboBoxEdit 中进行检查以将活动值保存在数据库中。 我有一个包含 N 数据量的列表,我只想保存活动数据。
谢谢!!
【问题讨论】:
标签: c# devexpress
我想知道如何在 CheckedComboBoxEdit 中进行检查以将活动值保存在数据库中。 我有一个包含 N 数据量的列表,我只想保存活动数据。
谢谢!!
【问题讨论】:
标签: c# devexpress
您可以使用 CheckedComboBoxEdit.Properties.GetItems.GetCheckedValues() 方法。它只是返回检查项目的值 底层列表控件。
要完成此任务,您还可以使用以下方法:
string items = string.Empty;
foreach (CheckedListBoxItem item in checkedComboBoxEdit1.Properties.GetItems())
if (item.CheckState == CheckState.Checked)
items += string.Format("{0} YES \r\n", item.Description);
else
items += string.Format("{0} NO \r\n", item.Description);
items = items.TrimEnd("\r\n".ToCharArray());
XtraMessageBox.Show(items);
更多参考资料:
Get Checked Items In A DevExpress CheckedComboBoxEdit
How to iterate through through CheckedComboBoxEdit
How to retrieve the checked items in the CheckedComboBoxEdit control
【讨论】:
private void btnGuardar_Click(object sender, EventArgs e) { EntidadRentas reg = new EntidadRentas(); for (int i = 0; i < checkedComboBoxEdit1.Properties.Items.Count; i++) { CheckedListBoxItem item = checkedComboBoxEdit1.Properties.Items[i]; if (item.CheckState == CheckState.Checked) { Renta.PeliculaId = (int)item.Value; ShowWaitDialog(); try {...
你好,你可以试试这个
CheckedComboBoxEdit.Properties.GetItems.GetCheckedValues()
如果它适合你,请告诉我。
有关 CheckedComboBoxEdit 成员的更多信息: https://documentation.devexpress.com/#WindowsForms/DevExpressXtraEditorsCheckedComboBoxEditMembersTopicAll
【讨论】: