Label lbl = new Label(); for (int x = 0; x <= 3; x++) { //create new label location after each loop //by multiplying the new value of variable x by 5, so the new label //control will not overlap each other. lbl.Location = new System.Drawing.Point(52 + (x * 5), 58 + (x * 5)); //create new id and text of the label lbl.Name = "label_" + x.ToString(); lbl.Text = "Label " + x.ToString(); this.panel1.Controls.Add(lbl); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)