此错误显示(“这会导致两个绑定源...”) [英] this error display("this causes Two binding source...")
本文介绍了此错误显示(“这会导致两个绑定源...”)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
点击显示按钮多次单击此错误显示(这会导致集合中的两个绑定绑定到同一属性参数name:binding)
这是我的代码:
da.SelectCommand = new SqlCommand( select * from student,cs) ;
DataTable dt = new DataTable();
ds.Clear();
da.Fill(ds);
dt = ds.Tables [ 0 ];
dataGridView1.DataSource = ds.Tables [ 0 ];
tblnamesbs.DataSource = dt;
this .textBox1.DataBindings.Add(Text, this .tblnamesbs,firstname, true ); // 错误
this .textBox2.DataBindings.Add(Text, this .tblnamesbs,lastname, true );
解决方案
在添加新绑定之前,您需要清除现有的数据绑定...
this .textBox1.DataBindings.Clear();
this .textBox1.DataBindings.Add(...);
hii,everyone
when click on display button more than one click this error display("this causes Two binding in the collection to bind to the same property parameter name: binding")
this is my code:
da.SelectCommand = new SqlCommand("select * from student ",cs);
DataTable dt = new DataTable();
ds.Clear();
da.Fill(ds);
dt=ds.Tables[0];
dataGridView1.DataSource = ds.Tables[0];
tblnamesbs.DataSource = dt;
this.textBox1.DataBindings.Add(Text,this.tblnamesbs,firstname,true);//error
this.textBox2.DataBindings.Add(Text,this.tblnamesbs,lastname,true);
解决方案
You need to clear the existing databindings before adding a new binding...
this.textBox1.DataBindings.Clear(); this.textBox1.DataBindings.Add(...);
这篇关于此错误显示(“这会导致两个绑定源...”)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文