如何在combbox显示上绑定不同的值。 [英] how to bind different value on combbox display.
本文介绍了如何在combbox显示上绑定不同的值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
列表< string> AndOr = new 列表< string>
{
AND,
或,
};
DataGridViewComboBoxCell ColumnAndOr =(DataGridViewComboBoxCell)(dataGridView1.Rows [ 0 ]。单元格[ 3 ] );
ColumnAndOr.DataSource = AndOr;
我使用上面的代码来绑定Gridview的组合框。它很好地向我展示了两种选择。现在我如何显示不同的值,而实际值(如上所述)保持不变。
实际值 显示值
AND操作AND
或操作或
解决方案
以下是使用Combo Box的DisplayMember和ValueMember属性的一些选项。
http://stackoverflow.com/questions/3063320/combobox-adding-text-and-value-to-an-item-no-binding-source [ ^ ]
List<string> AndOr = new List<string>
{
" AND ",
" OR ",
};
DataGridViewComboBoxCell ColumnAndOr = (DataGridViewComboBoxCell)(dataGridView1.Rows[0].Cells[3]);
ColumnAndOr.DataSource = AndOr;
i am using above code to bind Gridview's combobox. and it is showing me both option very well. Now how can i show different values while the actual values (as i describe above) remain same.
Actual Value display value
"AND" "Operation AND"
"OR" "Operation OR"
解决方案
Here are some options using the Combo Box's DisplayMember and ValueMember properties.
http://stackoverflow.com/questions/3063320/combobox-adding-text-and-value-to-an-item-no-binding-source[^]
这篇关于如何在combbox显示上绑定不同的值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文