日期:2014-05-18 浏览次数:21014 次
combox.DataSoure = 数据源; combox.DisplayMember = 需要显示的字段名; combox.ValueMember = 选项ID的字段名; combox.Items.Insert(0,"--全部--"); //你在这添加这样一句
------解决方案--------------------
有VB.Net的代码,你翻译成C#就行了。
Public Class cmbValue Public ReadOnly ShowText As String Public ReadOnly value As String Public Sub New(ByVal ShowText As String, ByVal value As String) Me.ShowText = ShowText Me.value = value End Sub Public Overrides Function ToString() As String Return ShowText End Function End Class