读书人

string code = cmbCode.SelectedValue

发布时间: 2012-04-25 19:32:32 作者: rapoo

string code = cmbCode.SelectedValue.ToString();,code 值为System.Data.DataRowView
code断点调试出来的值是System.Data.DataRowView,是什么地方错了

[解决办法]
你没有绑定ValueMember的值吧,比如ComboBox.ValueMember=ZipCode

,如果想获得显示的值,用ComboBox.DisplayMember

msdn解释
If a property is not specified in ValueMember, SelectedValue returns the results of the ToString method of the object.

读书人网 >C#

热点推荐