Reputation: 49
I have an array of labels. I use these command lines to bind the Label's text to a column in my table, but it is not binding properly.
Here is the applicable code:
Label[] LL = new Label[26];
for (int i = 0; i < LL.Length; i++)
{
LL[i] = new Label();
LL[i].Text = null;
}
LL[0].DataBindings.Add(new System.Windows.Forms.Binding("Text",
this.table_010_UserInfoBindingSource, "Column07", true));
Upvotes: 2
Views: 350
Reputation: 22171
You are only binding the first label in your array. Move the LL[0].Databindings.Add...
line up into the for loop. Also, change the LL[0]
to LL[i]
or you will bind the same label over and over again.
Upvotes: 5