开发者

c# databinding combobox change fields

I have databound a DataTable to a combobox, and I have a textbox that is also linked to a field in this same table. The Date field updates as expected when switched between records, but changing the value of the Date field causes the list entry in the combobox to change to System.Data.DataRowView. The record still selects fine.

Here is the sample code;

comboBox1.Da开发者_JAVA百科taSource = TblA;
comboBox1.DisplayMember = "ID";

BindingContext binding = this.BindingContext;

BindingManagerBase IDSelected = binding[comboBox1.DataSource];

textBox1.DataBindings.Add("Text",TblA,"Date");


Try using Datasource Update Mode to Never

Binding Constructor (String, Object, String, Boolean, DataSourceUpdateMode)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜