Hi guys,
I am trying to write a code which will create labels at runtime vertically after selecting a value from a combobox. I am only getting one label created at the starting position.
Can you please tell me what the problem is and how can I fix it? Thanks
Here is my code:
private Label[] label;
int b = 70, d = 157; //these two are the coordinates where the label(s) should start creating
for (int i = 1; i < count; i++)
{
label[i] = new Label();
label[i].Visible = true;
label[i].Location = new System.Drawing.Point(b, d);
label[i].Size = new Size(80, 70);
label[i].TabIndex = 1;
label[i].Text = i.ToString();
this.Controls.Add(label[i]);
this.ResumeLayout(false);
d += 40;
}