Hello,
How tow create multiple dynamic label in Windows application c#.
i have been tried this but not working..
lblUsedShadeInImage.BorderStyle = BorderStyle.FixedSingle;
lblUsedShadeInImage.AutoSize = false;
lblUsedShadeInImage.BackColor = Color.Black;
pnlRecentshade.Controls.Add(lblUsedShadeInImage);
Please provide the solution for multiple dynamic label.
Thanks
Prashant
Create multiple dynamic label in C# window form
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Priya LingeRank #785 · 2.9K reputationPosted Jul 26, 2011, 10:10 PM EDT
You can create multiple dynamic lables in C# by following way.
public Form1()
{
InitializeComponent();
int x=20; int y=70;
for(int i=0;i<10;i++)
{
panel1.Controls.Add(new Lable{Text="I am lable",Height=20,Width=100,Name="lable"+i,BackColor=Color.White,Location=new Point(x,y)});
panel1.Controls.Add(new TextBox{Text="I am TextBox",Height=30,Width=100,Name="Text"+i,BackColor=Color.White,Location=new Point(x+100,y)});
y+=30;
}
}
Please see the attached file.
Hope this will help you.
Thanks.
Suthish NairRank #92 · 22.8K reputationPosted Jul 26, 2011, 10:12 PM EDT
Label lblUsedShadeInImage = new Label();