DataBindings.Add() Problem.
سلام
من یه دیتاگرید ویو دارم که داده ها توش نمایش داده میشن، حالا میخوام روی هر رکوردی که میره اطلاعات اون توی کنترل های مخصوص خودش نمایش داده بشن، منتها نمیدونم چطوری، قبلا اینکار رو با DataRow انجام میدادم، ولی حالا با DataBinding میخوام انجام بدم، فرض کنید یه تابعی دارم که کنترل ها رو بایند میکنه :
private void BindData()
{
this.txt_customerID.DataBindings.Add("Text", this.dt, "customerID");
this.txt_companyName.DataBindings.Add("Text", this.dt, "companyName");
this.txt_city.DataBindings.Add("Text", this.dt, "city");
this.txt_country.DataBindings.Add("Text", this.dt, "country");
}
و اینطوری هم فراخوانی میکنم :
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
this.BindData();
}
منتها در runTime این Exception اتفاق میفته :
This causes two bindings in the collection to bind to the same property.
Parameter name: binding
ممنون میشم راهنماییم کنید، مرسی