Click here to Skip to main content
15,890,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
C#
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);
Posted
Updated 7-Jan-14 18:35pm
v2

1 solution

You need to clear the existing databindings before adding a new binding...

C#
this.textBox1.DataBindings.Clear();
this.textBox1.DataBindings.Add(...);
 
Share this answer
 
Comments
mhassan083 8-Jan-14 1:15am    
good,thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900